Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

[Perl6] Sort a hash by value

by haoess (Curate)
on Dec 09, 2008 at 19:01 UTC ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 02:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found