in reply to sorting an array
OK, so it's calling substr rather a lot of times, so with a large array that might be slow. Alternatively we could cache it:my @sorted = sort { substr($a,2) <=> substr($b,2) } @array;
@array = map {substr($_,2)} @array; my @sorted = sort { $a <=> $b } @array; @sorted = map { "ch$_" } @sorted;
|
|---|