You dont really need to use a hash ... just read in the files and then push
them onto an array as u print out the options ... then read in the option
number and that will be the index of the array (remember to take the index
starting from zero into account)
On Wed, Aug 22, 2001 at 11:17:30AM -0400, Messervy, Joe M shaped the electrons to read:
> Hello,
> I hope someone can point me in the right direction. As a newbie I am just
> not sure where to go from here.
>
> I have a directory where I have several commands, I would like to create a
> script that reads the files, prints them out and allows the user to pick
> which one of the commands to run.
>
> All I have right now is a skeleton of the script I would like, but would
> appreciate some direction.
>
> #!/usr/local/bin/perl -w
> opendir THISDIR, "./" or die "egad!: $!";
> @allfiles = grep !/^\.\.?$/, readdir THISDIR;
> closedir THISDIR;
>
> for $file (@allfiles) {
> if ($file !~ /on.lst*|scriptfile.pl/i) { #files I don't want
> printed as they are not valid scripts for users
> print "$file\n";
> }
> }
>
> What I have above would let the user do a simple cut and paste, but this is
> not completly what I need.
> I think what I want to do is create a hash with the filenames and a number
> (this could be gotten from a count++) and then do something like prompting
> the user for the number they want and then doing an exec on that.
>
> Thanks for any help.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]