Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: sorting a list of hashes on an element/attribute of the hash

by vrk (Chaplain)
on Jun 04, 2007 at 13:59 UTC ( #619127=note: print w/replies, xml ) Need Help??


in reply to sorting a list of hashes on an element/attribute of the hash

There are a few ways, but here's one:

@$data = sort { $a->{order} <=> $b->{order} } @$data;

--
print "Just Another Perl Adept\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://619127]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2018-06-21 10:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (118 votes). Check out past polls.

    Notices?