Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

[Perl6] Sort a hash by value

by haoess (Curate)
on Dec 09, 2008 at 19:01 UTC ( #729238=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %nums = (
      four  => 4,
      one   => 1,
    ...
    for %nums.keys.sort: { %nums{$^a} <=> %nums{$^b} } -> $key {
        say "$key {%nums{$key}}";
    }
    
  2. or download this
    one 1
    two 2
    three 3
    four 4
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-12-21 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (101 votes), past polls