Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: sorting arrays in respect to a different hash's values

by linuxer (Curate)
on May 23, 2009 at 14:19 UTC ( [id://765827]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -l
    use strict;
    ...
    
    print "@arr";
    print "@sorted";
    
  2. or download this
    my @sorted = sort { $hash{$a} cmp $hash{$b} } @arr;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found