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

You should check the output of open:
open WRITE, '<', '$file' or die $!;
You are trying to open the file named '$file', quotes included. No such files exists. You need no quotes here.