please excuse my inability to understand this code. but what is: while ( <*> ) and where is the piece of code that tells what directory/path to look in? where does it go? Thanks, Lino
"Paul D. Kraus" <[EMAIL PROTECTED]> wrote: On Thu, May 06, 2004 at 03:28:51PM -0700, Lino Iozzo wrote: > Here is an example: > > I have a file and save it to a directory whether it is one file or multiple files > then i go to my perl script and type retrievelist.pl this should look into the > specified directory in the code and display everything in this directory. > > Then retrieve list should prompt the user to select one of the files it returned and > then this would invoke another perl command called parselist.pl. > > this should all take place in the retrieve list for now until i build a menu > system...and i don't know when this will happen. > Well without still more info such as what you want to do with the list this script will read the current directory and store all the file names into an array. You could use a hash or even process each file one at a time. Code is untested. HTH, Paul Kraus Code -=-=-= use strict; use warnings; my @files; while ( <*> ) { next if ( /\.|\../ ); # skip the '.' and '..' directory my $filename = $_; push ( @files, $filename ); #### or you could process each file as it is found ... open ( IN, "<$filename" ) or die (" could not open file $!\n" ); while ( ){ ###Parse file here } } foreach my $ file ( @files ) { open ( IN, "<$file" ) or die (" could not open file $!\n" ); while ( ){ ###Parse file here } }