{"id":3538,"date":"2010-10-15T16:23:00","date_gmt":"2010-10-15T16:23:00","guid":{"rendered":""},"modified":"2026-04-18T22:53:03","modified_gmt":"2026-04-18T22:53:03","slug":"sorting-in-perl","status":"publish","type":"post","link":"https:\/\/hellem.org\/wblog\/?p=3538","title":{"rendered":"Sorting in Perl"},"content":{"rendered":"<p>I have had it with a menu in Build Forge &#8211; could not understand why the elements where not alphabetically sorted even though the Perl script generating the menu had a line like this<\/p>\n<p><!-- codeblock lang=\"\" line=\"1\" --><\/p>\n<pre><code>sort( @entries );<\/code><\/pre>\n<p><!-- \/codeblock --><\/p>\n<p>So Google to the rescue, I found this article about Perl Sorting Techniques http:\/\/www.perlfect.com\/articles\/sorting.shtml and just had to change the line of code to <\/p>\n<p><!-- codeblock lang=\"\" line=\"1\" --><\/p>\n<pre><code>@entries = sort { $a cmp $b } @entries;<\/code><\/pre>\n<p><!-- \/codeblock --><\/p>\n<p>Problem solved!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have had it with a menu in Build Forge &#8211; could not understand why the elements where not alphabetically sorted even though the Perl script generating the menu had a line like this sort( @entries ); So Google to the rescue, I found this article about Perl Sorting Techniques http:\/\/www.perlfect.com\/articles\/sorting.shtml and just had to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-3538","post","type-post","status-publish","format-standard","hentry","category-work-geek"],"_links":{"self":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3538"}],"version-history":[{"count":1,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3538\/revisions"}],"predecessor-version":[{"id":14061,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3538\/revisions\/14061"}],"wp:attachment":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}