{"id":24,"date":"2008-08-12T15:59:47","date_gmt":"2008-08-12T20:59:47","guid":{"rendered":"http:\/\/www.popmartian.com\/tipsntricks\/?p=24"},"modified":"2012-04-30T10:41:23","modified_gmt":"2012-04-30T15:41:23","slug":"perl-howto-push-a-hash-onto-an-array","status":"publish","type":"post","link":"https:\/\/www.popmartian.com\/tipsntricks\/2008\/08\/12\/perl-howto-push-a-hash-onto-an-array\/","title":{"rendered":"perl howto push a hash onto an array"},"content":{"rendered":"<p>This could also be called how to make an arrays of hashes.  The basic idea is to create a list of items that when iterated, returns individual hashes.<\/p>\n<p><code>use Data::Dumper;<br \/>\nmy @array;<br \/>\npush @array, {'key1' =&gt; 'value1', 'key2' =&gt; 'value2'};<br \/>\npush @array, {'key1' =&gt; 'value1', 'key2' =&gt; 'value2'};<br \/>\npush @array, {'key1' =&gt; 'value1', 'key2' =&gt; 'value2'};<br \/>\nprint Dumper(@array);<\/code><\/p>\n<p>Will give you:<br \/>\n<code><br \/>\n$VAR1 = {<br \/>\n'key2' =&gt; 'value2',<br \/>\n'key1' =&gt; 'value1'<br \/>\n};<br \/>\n$VAR2 = {<br \/>\n'key2' =&gt; 'value2',<br \/>\n'key1' =&gt; 'value1'<br \/>\n};<br \/>\n$VAR3 = {<br \/>\n'key2' =&gt; 'value2',<br \/>\n'key1' =&gt; 'value1'<br \/>\n};<br \/>\n<\/code><\/p>\n<p>Snazzy!<\/p>\n<blockquote><p>Did you find this post useful or have questions or comments?\u00c2\u00a0 Please let me know!<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This could also be called how to make an arrays of hashes. The basic idea is to create a list of items that when iterated, returns individual hashes. use Data::Dumper; my @array; push @array, {&#8216;key1&#8217; =&gt; &#8216;value1&#8217;, &#8216;key2&#8217; =&gt; &#8216;value2&#8217;}; &hellip; <a href=\"https:\/\/www.popmartian.com\/tipsntricks\/2008\/08\/12\/perl-howto-push-a-hash-onto-an-array\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12,9],"tags":[],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-how-to-do-stuff","category-perl","category-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":4,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/24\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}