in reply to Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code
EDIT: Also, I would personally change the code so you are only opening the outfile once and closing it once scanning the dir is complete. Open it, scan dirs, then close it. Also the way you are opening the outfile '>' in the foreach loop, it will knock out/delete the contents foreach file in said directory, so in essence you will only have data from the last file in the outfile. Maybe that is what you want though.foreach (@files) { next if( -d $_); open my $in_fh, '<', $_; ...rest of code... }
|
|---|