Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 studying the Monastery: (5)
As of 2014-10-01 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (9 votes), past polls