in reply to Custom Sort Array
sub by_id { # extract numbers my ($A) = $a =~ /(\d+)/; my ($B) = $b =~ /(\d+)/; # return comparison return $A <=> $B; } for my $f (sort by_id @files) { say $f; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Custom Sort Array
by 2teez (Vicar) on Aug 10, 2013 at 20:42 UTC | |
Re^2: Custom Sort Array
by omegaweaponZ (Beadle) on Aug 10, 2013 at 19:43 UTC | |
by arkturuz (Curate) on Aug 10, 2013 at 20:44 UTC | |
Re^2: Custom Sort Array
by Anonymous Monk on Aug 12, 2013 at 16:46 UTC |