in reply to Re^2: Opening a File Twice
in thread Opening a File Twice
toforeach (@files) {
Then you could replaceforeach my $file (@files) {
with$outputfile = "STEP2_" . $_; open(OUTFILE, ">" , $outputfile) or die $!;
The value of $_ is almost certainly used for more than the name of the file being processed. These changes will guarantee the filename is retained, and associate the actual filename with the error.$outputfile = "STEP2_" . $file; open(OUTFILE, ">" , $outputfile) or die "opening $outputfile $!";
Revise: The foreach was corrected, thanks to moritz kindly pointing out my gaffe.
|
|---|