foreach my $file ( map { $_->[0] } sort { $a->[1] cmp $b->[1] or $a->[2] <=> $b->[2] } map { [ $_, /^(\D*)(\d+)/ ] } keys %hash )