Hello...
This is probably a very simple question, but I don't have much
experience using hashes...
I have a simple program that lists all of the files on a
directory:
@files = </dir/*>;
foreach $file (@files) {
print "$file\n";
}
which prints something like this:
/dir/file1
/dir/file2
/dir/file3
etc.
But an array doesn't suit my needs. What I really need is a
hash where each item in the directory is a value associated with a key that
is a number 1-n such that I could issue a print statement that would show
something like (to oversimplify!):
print "$key(%hash) $value(%hash)\n";
1 /dir/file1
2 /dir/file2
3 /dir/file3
etc.
such that I could do something like this:
$key = <STDIN>;
do something with $value associated with $key;
Any clues would be welcome...
-Chris