Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: sorting hash by a certain value (that it is in an array)

by clueless newbie (Hermit)
on Jul 17, 2012 at 16:06 UTC ( #982273=note: print w/ replies, xml ) Need Help??


in reply to Re^2: sorting hash by a certain value (that it is in an array)
in thread sorting hash by a certain value (that it is in an array)

Perhaps you could use Tie::IxHash?

my %unordered=(...); tie my %ordered, "Tie::IxHash"; for my $key (sort {$unordered{$a}[1] cmp $unordered{$b}[1]} keys %$ +unordered) { $ordered{$key}=$unordered->{$key}; };


Comment on Re^3: sorting hash by a certain value (that it is in an array)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2015-07-04 21:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls