http://www.perlmonks.org?node_id=1051836


in reply to Console output != file output

Tip #1 from the Basic debugging checklist: warnings

print() on closed filehandle FH at

You are opening the file for input, not output: see open. This works for me:

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