more useful options | |
PerlMonks |
Re: How to perform different sorts on multiple sections of items in the same arrayby johngg (Canon) |
on Dec 30, 2014 at 01:03 UTC ( [id://1111659]=note: print w/replies, xml ) | Need Help?? |
Rather than complicated sorting routines, perhaps it would be preferable to set up a couple of "flags" depending on what type the string is and, consequently, what character to sort on then pack them along with the original string to do a GRT sort. This will not be stable for the last two categories if the strings share the same sorting character, at which point they will be sorted in ascending alpha.
The output.
I hope this is of interest. Update: Corrected statement re. stable sorting, s/first/last/ Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|