Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: sorting hash of array of hashes by value

by AppleFritter (Vicar)
on Aug 26, 2014 at 18:59 UTC ( [id://1098651]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @sorted = sort @unsorted;
    
    say foreach @sorted; # Output in sorted order
    
  2. or download this
    my %sorted = sort %unsorted # DOES NOT WORK!
    
    say foreach (sort values %unsorted) # workaround (if you don't care ab
    +out keys)
    say $sorted{$_} foreach (sort keys { $unsorted{$a} <=> $unsorted{$b} }
    + %unsorted) # workaround (general)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-19 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found