Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a list of files:
file1
file2
...
file10
...
file20
...
The list can contain any number of file names up to about 1000. I have these names stored in a hash, and use the following code to print the file names:
file1
file10
file11
file2
file20
file3
How do I sort them based on counting order? I don't have access to install any modules that are not already installed on the system, so please don't suggest a module.
Thanks in Advance.
file1
file2
...
file10
...
file20
...
The list can contain any number of file names up to about 1000. I have these names stored in a hash, and use the following code to print the file names:
problem is the the filenames print like this:foreach my $file (sort {$a cmp $b} keys %hash) { print "$key \n"; }
file1
file10
file11
file2
file20
file3
How do I sort them based on counting order? I don't have access to install any modules that are not already installed on the system, so please don't suggest a module.
Thanks in Advance.
Back to
Seekers of Perl Wisdom