Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
my @arr = <DATA>;
chomp(@arr);
@arr = sort {sortem()} @arr;
print "$_\n" for @arr;
sub sortem {
my ($x, $y) = ($a =~ /(\d+)/, $b =~ /(\d+)/);
$x <=> $y;
}
__DATA__
abc031.txt
xy001.txt
mikey5.txt
file101.txt
file06.txt
my @arr = <DATA>;
chomp(@arr);
@arr = map {$_->[1]}
sort {$a->[0] <=> $b->[0]}
map {[/(\d+)/, $_]} @arr;
print "$_\n" for @arr;
__DATA__
abc031.txt
xy001.txt
mikey5.txt
file101.txt
file06.txt
use Sort::Fields;
my @sorted = fieldsort '(?<=\D)(?=\d)|\.', [ 1, '2n' ], @unsorted;
@arr = map {$_->[2]}
sort {$a->[0] cmp $b->[0] || $a->[1] <=> $b->[1]}
map {[/^(\D+)/, /(\d+)/, $_]} @arr;