Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: sorting hash of array of hashes by value

by AppleFritter (Vicar)
on Aug 26, 2014 at 18:59 UTC ( #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? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (None)
    As of 2021-10-17 01:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (70 votes). Check out past polls.

      Notices?