I'm guessing that 'file' was just an example of a name that the orginal poster was using. It isn't very likely that the filenames will be exactly 4 chars long followed by a number. This will probably work better (untested):
sub file_sort { $a =~ /(\d*)$/; my $a_num = $1; $b =~ /(\d*)$/; my $b_num = $1; $a_num <=> $b_num; } foreach my $file (sort &file_sort keys %hash) { print "$key \n"; }
In reply to Re: Re: Sorting Files with Numbers
by hardburn
in thread Sorting Files with Numbers
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |