in reply to Multiple Sorts
Here is how you adapt a Schwartzian transform to sort multiple fields - this sorts on field 1 first then field 2 then 3. Sorting on multiple fields is explained in the perlman:perlfunc under sort.
@list = <DATA>; @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] || $a->[2] cmp $b->[2] || $a->[3] cmp $b->[3] } map { [ $_, split/\|/ ] } @list; print @sorted; __DATA__ C|A|A C|B|A C|C|A B|A|A B|B|A B|C|A A|A|A A|B|A A|C|A C|A|B C|B|B C|C|B B|A|B B|B|B B|C|B A|A|B A|B|B A|C|B C|A|C C|B|C C|C|C B|A|C B|B|C B|C|C A|A|C A|B|C A|C|C
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|