Welcome to the Monastery | |
PerlMonks |
Hash keys affect sortingby 0xbeef (Hermit) |
on Jul 07, 2006 at 15:36 UTC ( [id://559809]=perlquestion: print w/replies, xml ) | Need Help?? |
0xbeef has asked for the wisdom of the Perl Monks concerning the following question:
I am struggling to find a solution in sorting a reasonably complex hash-of-hashes directly if the sort key is located a number of levels below the first keys in the hash.
I bypass this problem (inefficiently) by deriving a second simplified hash through which I can then sort by time. Hopefully this simplified example will illustrate it more clearly:
I know a possibility would be to reconstruct the original hash in the %ERROR2 format - but this is not feasible due to other issues, so I'm stuck with two hashes to avoid the effect that RES and DESC keys would have when traversing %ERROR in a for loop. Is there a method which would avoid the need for %ERROR2, and still provide output of "each class sorted by time"? -Niel
Back to
Seekers of Perl Wisdom
|
|