Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: hash of hashes sort second level keys

by rubasov (Friar)
on Feb 19, 2010 at 22:42 UTC ( #824275=note: print w/ replies, xml ) Need Help??


in reply to Re^2: hash of hashes sort second level keys
in thread hash of hashes sort second level keys

It's not totally clear for me what does it mean "trying to sort the entire hr on the keys of layer 4 first and layer 3 second", but if it means to sort by the 4th column as the key and 3rd column as a subkey, then probably you wanted to write this to sort the flattened array:

sort { $a->[3] <=> $b->[3] or $a->[2] <=> $b->[2] } @flat_array


Comment on Re^3: hash of hashes sort second level keys
Download Code
Re^4: hash of hashes sort second level keys
by aeaton1843 (Acolyte) on Feb 19, 2010 at 23:40 UTC

    "if it means to sort by the 4th column as the key and 3rd column as a subkey" is exactly what I was doing. That is very nice! This is exactly what I was looking for, great answer. I will rewrite some code and see how it goes. Thanks again for the replies!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (18)
As of 2014-09-22 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls