$ perl -w -e 'close FILEHANDLE; print ' readline() on closed filehandle FILEHANDLE at -e line 1. $ perl -w -Mdiagnostics -e 'close FILEHANDLE; print ' readline() on closed filehandle FILEHANDLE at -e line 1 (#1) (W closed) The filehandle you're reading from got itself closed sometime before now. Check your control flow. $ perl -w -Mdiagnostics -e 'my $s="text"; print <$s>' readline() on unopened filehandle at -e line 1 (#1) (W unopened) An I/O operation was attempted on a filehandle that was never initialized. You need to do an open(), a sysopen(), or a socket() call, or call a constructor from the FileHandle package. $