in reply to Sorting Files with Numbers
However, that is not optimal for the sort.foreach my $file ( sort { my($as,$an) = $a =~ /^(\D*)(\d+)/; my($bs,$bn) = $b =~ /^(\D*)(\d+)/; $as cmp $bs or $an <=> $bn } keys %hash )
foreach my $file ( map { $_->[0] } sort { $a->[1] cmp $b->[1] or $a->[2] <=> $b->[2] } map { [ $_, /^(\D*)(\d+)/ ] } keys %hash )
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|