A solution using a Schwartzian Transform.
knoppix@Knoppix:~$ perl -le ' @arr = qw{ ch1 ch11 ch2 ch5 ch55 ch16 }; print for map { $_->[ 0 ] } sort { $a->[ 1 ] <=> $b->[ 1 ] } map { [ $_, ( split m{(?<=\D)(?=\d)} )[ 1 ] ] } @arr;' ch1 ch2 ch5 ch11 ch16 ch55 knoppix@Knoppix:~$
I hope this is of interest.
Cheers,
JohnGG
In reply to Re: sorting an array
by johngg
in thread sorting an array
by Selvakumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |