in reply to Need help in sorting the array
You could do it like this using a couple of maps sandwiching a sort.
$ perl -le ' > @arr = qw{ TEXT1 TEXT3 TEXT11 TEXT2 TEXT13 }; > print for > map { $_->[ 0 ] } > sort { $a->[ 1 ] <=> $b->[ 1 ] } > map { [ $_, ( split m{(?<=[A-Z])(?=\d)} )[ 1 ] ] } > @arr;' TEXT1 TEXT2 TEXT3 TEXT11 TEXT13 $
I hope this is helpful.
Cheers,
JohnGG
|
|---|