Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Sort Values in Hash, While Tracking Keys.

by hipowls (Curate)
on Jan 29, 2008 at 02:30 UTC ( [id://664829]=note: print w/replies, xml ) Need Help??


in reply to Sort Values in Hash, While Tracking Keys.

my ( $key, $value ) = @{ # 5. dereference anonymous hash + ( sort { $a->[1] <=> $b->[1] } # 3. sort numerically by value map { [ $_ => $hash{$_} ] } # 2. convert to anonymous array keys %hash # 1. each key )[-1] # 4. get last (highest value) };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-23 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found