On Wed, 05 Nov 2003 15:23:49 -0700, McMahon, Chris wrote: > 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!):
If I understand you correctly, you just want to map each directory/file with an incremental number. An array already have an internal number; the index of the actual element in the array. So: my @files = </dir/*>; my $key = <STDIN>; my $element = $files[$key - 1] || "No directory/file at position $key"; print $element . "\n"; -- Tore Aursand <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]