{"id":323,"date":"2013-06-25T11:22:15","date_gmt":"2013-06-25T10:22:15","guid":{"rendered":"http:\/\/www.nax.cz\/?p=323"},"modified":"2013-06-25T11:22:15","modified_gmt":"2013-06-25T10:22:15","slug":"compare-2-arrays-in-perl-5-10","status":"publish","type":"post","link":"https:\/\/nax.cz\/?p=323","title":{"rendered":"compare 2 arrays in perl 5.10"},"content":{"rendered":"<p>Ever needed to compare 2 arrays in perl? Ultimate way is to use Array::Compare module, but for some reasons I was getting following error:<\/p>\n<p>Argument 1 is not an array<\/p>\n<p>Even thou I was casting both array pointers to array.<\/p>\n<p><code>if ($comp->compare(@{$array1}, @{$array2})) {<\/code><\/p>\n<p>Solution (because I was using 5.10 perl) is to use smart match operator:<\/p>\n<p><code><br \/>\nif ( @{$array1} ~~ @{$array2}) {<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever needed to compare 2 arrays in perl? Ultimate way is to use Array::Compare module, but for some reasons I was getting following error: Argument 1 is not an array Even thou I was casting both array pointers to array. if ($comp->compare(@{$array1}, @{$array2})) { Solution (because I was using 5.10 perl) is to use smart [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-323","post","type-post","status-publish","format-standard","hentry","category-perl"],"_links":{"self":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=323"}],"version-history":[{"count":0,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/323\/revisions"}],"wp:attachment":[{"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}