This is a common problem I come across when writing:

print() on closed filehandle OUTFILE at ./something.pl line 24, <INFILE> line 46.

99% of the time for me, the problem is attempting to load a file in a directory that doesn’t exist.