Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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??


in reply to Printing keys from a hash by value?

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.


Comment on Re: Printing keys from a hash by value?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950783]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-12-27 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls