in reply to Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code

Like already said, you are trying to open '.' and '..' as a file, and its NOT.

Try this:
foreach (@files) { next if( -d $_); open my $in_fh, '<', $_; ...rest of 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.

Opening it with '>' would be fine if it were opened before of the foreach loop and closed after the foreach loop.
  • Comment on Re: Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code
  • Download Code