Since I haven't done a version of my standard "natural sort" trick that handles negative numbers recently, here goes:
- tye (but my friends call me "Tye")my @deltas= qw( -6h0m +11h39m 0h2m +1h7m -12h8m ); @deltas= @deltas[ do { s#([-+]?\d+)# "\x80" ^ pack"N",$1 #ge for my @sort= @deltas; sort { $sort[$a] cmp $sort[$b] } 0..$#sort; } ]; print "@deltas\n";
In reply to (tye)Re: Sorting strings ("natural sort" w/ negatives)
by tye
in thread Sorting strings
by rbi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |