in reply to Re^2: Confused when reading Input within Perl and Shell Scripts
in thread Confused when reading Input within Perl and Shell Scripts
Think about how the contents of the external file containing the file names are going to get into the @filenames array. At present your code has nothing to do that. One way would be:
my $namesFileName = shift; # Get name of the file names file from comm +and line open my $inNames, '<', $namesFileName or die "Unable to open $namesFil +eName: $!\n"; my @filenames = <$inNames>; # Read the file names (one per line) close $inNames; chomp @filenames; # Remove the line end character from each entry ...
or you could replace the for loop with a while loop and eliminate the array:
use strict; use warnings; my $namesFileName = shift; # Get name of the file names file from co +mmand line open my $inNames, '<', $namesFileName or die "Unable to open $namesFil +eName: $!\n"; while (<$inNames>) { chomp; # Remove line end character from file name open my $dsspIn, '<', $_ or die "Unable to open $_: $!\n"; ... } close $inNames;
|
|---|