print() on closed filehandle FH at #### use warnings; use strict; my $type = 123; open (FH, '>out.txt'); print FH "start" . $type . "end"; close FH;