in reply to Need help in sorting the array
From the OP:
my @arr1; foreach my $val (@arr) { $val =~ s/TEXT//gx; push @arr1, $val; }
Note that because $val is aliased in the loop above, the source array @arr is modified!
>perl -wMstrict -le "my @source = qw(TEXT1 TEXT11 TEXT13 TEXT2 TEXT3); for my $val (@source) { $val =~ s/TEXT//; } print qq{@source}; " 1 11 13 2 3
|
|---|