my @array = qw(a1_2 a1_1 a10_10 a2_10 a2_1 a2_2 a10_1 a10_2 a1_10); my @sorted = map { $_->[0] } sort {$a->[1] <=> $b->[1] } map { my $v = $_; tr/a_/0./; [$v, $_] } @array;
Make a float pair for each element of the array. Substitute 'a' with 0, and '_' with floating point '.'. Then sort the pairs by numbers and take original elements from sorted pairs
In reply to Re: Sort problems
by ccn
in thread Sort problems
by erez_ez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |