good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: sort hash by valueby GrandFather (Saint) |
on Mar 25, 2014 at 01:18 UTC ( [id://1079616]=note: print w/replies, xml ) | Need Help?? |
You can nest maps in much the same way you can nest for loops. It's not clear that there is a win doing that here, but consider:
Prints:
Note that @items contains the sorted values rather than the keys which cleans up the print statement somewhat. The map just to the right of the @items assignment does the lookup.
If the code changes take longer than the time saved, it's fast enough already.
In Section
Seekers of Perl Wisdom
|
|