Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
The secondary sort criteria is where it gets tricky. For elements that are an anonymous array of the same size, I want them to appear in ascending asciibetical order working from the last element to the front.@list = sort {@$a <=> @$b} @list;
should end up sorted as['blah', 'asdf', 'foo', 'bar'], ['two'], ['zzz', 'def', 'ghi'], ['one'], ['mmm', 'def', 'ghi'], ['qqq', 'xyz', 'aaa']
Any ideas?['one'], ['two'], ['qqq', 'xyz', 'aaa'], ['mmm', 'def', 'ghi'], ['zzz', 'def', 'ghi'], ['blah', 'asdf', 'foo', 'bar'],
Update: In an effort to be more clear, here are the instructions I would give someone to sort them by hand.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Custom Sort An AoA
by Corion (Patriarch) on Apr 01, 2014 at 16:10 UTC | |
by Limbic~Region (Chancellor) on Apr 01, 2014 at 17:09 UTC | |
Re: Custom Sort An AoA
by kennethk (Abbot) on Apr 01, 2014 at 16:34 UTC | |
by Limbic~Region (Chancellor) on Apr 01, 2014 at 17:28 UTC | |
by SuicideJunkie (Vicar) on Apr 01, 2014 at 17:43 UTC | |
by LanX (Saint) on Apr 01, 2014 at 18:42 UTC | |
by Limbic~Region (Chancellor) on Apr 02, 2014 at 12:11 UTC | |
by Limbic~Region (Chancellor) on Apr 01, 2014 at 17:54 UTC | |
by shmem (Chancellor) on Apr 02, 2014 at 08:20 UTC | |
| |
by kennethk (Abbot) on Apr 02, 2014 at 18:09 UTC | |
by SuicideJunkie (Vicar) on Apr 01, 2014 at 17:31 UTC | |
by kennethk (Abbot) on Apr 02, 2014 at 18:13 UTC | |
Re: Custom Sort An AoA
by davido (Cardinal) on Apr 01, 2014 at 18:30 UTC | |
Re: Custom Sort An AoA
by AnomalousMonk (Archbishop) on Apr 01, 2014 at 17:40 UTC | |
Re: Custom Sort An AoA
by johngg (Canon) on Apr 01, 2014 at 18:34 UTC | |
Re: Custom Sort An AoA
by wind (Priest) on Apr 01, 2014 at 20:28 UTC | |
Re: Custom Sort An AoA
by kcott (Archbishop) on Apr 02, 2014 at 04:01 UTC | |
Re: Custom Sort An AoA
by Anonymous Monk on Apr 01, 2014 at 16:08 UTC |