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

If you put print "$_\n"; at the top of your for loop you'll see what's going on.

readdir returns the file names without the path of the directory you opened, so you've got to open "$dir/$_" as well as skipping any directories.

I generally find glob much easier and quicker to use than readdir.

  • Comment on Re: Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code
  • Download Code