![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Sorting an array on two computed fieldsby davido (Cardinal) |
on Dec 16, 2005 at 10:11 UTC ( #517196=note: print w/replies, xml ) | Need Help?? |
Something like this?
...untested, but it ought to work. The biggest problem is figuring out the best use of whitespace in making such a construct look pretty. Update: For the record, I just tested it, and yes, it works as advertised. ;) The Schwartzian Transform isn't really a necessary part of it all, but to me, it makes it easier to read than if I had put all the splitting in the sort code block. Also, the or is used for "fall through". If the first comparison evaluates to equality, the logic falls through to the second comparison. Update-2: Here is it without the Schwartzian Transform. ...maybe it's not that ugly after all, though as the data set grows it may become less efficient:
Dave
In Section
Seekers of Perl Wisdom
|
|