in reply to Read first line from each file in a directory

Another problem you may have is that readdir returns sub-directories as well as files. If you are on unix, that means you will get the special . and .. directories, which you do not want. You will need grep and -f.

See also autodie

  • Comment on Re: Read first line from each file in a directory