foreach my $value (%top_words)
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 reply to Re: Printing keys from a hash by value?
by Corion
in thread Printing keys from a hash by value?
by jms53
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |