If you need descending order, rather than wastefully filtering the sorted results through reverse you can instead just swap $a and $b:
And since we are on the topic, be sure and check out the Schwartzian Transform.for (sort { $b->[1] <=> $a->[1] } @data) { print join( ' : ', @$_ ), $/; }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re^3: Sort string according to numbers in it
by jeffa
in thread Sort string according to numbers in it
by Alexander75
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |