in reply to Re^2: Read first line from each file in a directoryin thread Read first line from each file in a directory
And your opendir will only work (by accident) if you are in the root folder when you start the script.