Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: hash of hashes sort second level keys

by rubasov (Friar)
on Feb 19, 2010 at 22:42 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://824275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-20 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found