rob_smith01 has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know how I can read in multiple files from a directory at one time. I have a created a script which can read in a singlular file line by line. I have made it soit maniputes the data the way inwhich I need to. cheers Rob
  • Comment on reading in multiple files froma linux directory

Replies are listed 'Best First'.
Re: reading in multiple files froma linux directory
by bikeNomad (Priest) on Jul 18, 2001 at 19:35 UTC
    You can set @ARGV to the list of files in a BEGIN block:

    # do a line count of all my .pl files: BEGIN { @ARGV=glob("*.pl") } my $i = 0; while (<>) { $i++; } print "$i\n";
Re: reading in multiple files froma linux directory
by twerq (Deacon) on Jul 18, 2001 at 19:31 UTC
    The general practice is to opendir, then readdir into an array, then step through the array doing your file processing on each element.

    --twerq