|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: Printing keys from a hash by value?by Corion (Pope) |
| on Jan 30, 2012 at 14:40 UTC ( #950783=note: print w/ replies, xml ) | Need Help?? |
|
I think you mean reverse( sort keys(%top_words)) there. Also see perlfaq4 on How do I sort a hash (optionally by value instead of key)?. Your approach loses one of the keys whenever two keys have the same value.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||