in reply to Not printing to file, but print to screen ok

I don't see anything obvious with your code. Try taking a few steps backwards, and just run the following code. It should create a file named 'foo.tmp' with just one line (bar). It also checks the success of print. Do you get any errors?
use strict; use warnings; my $list = 'foo'; my $newline = "bar\n"; open FH, '>', "$list.tmp" or die "$list == $!"; print FH $newline or die "Error print: $!"; close FH; print $newline;

Replies are listed 'Best First'.
Re^2: Not printing to file, but print to screen ok
by almut (Canon) on Mar 17, 2010 at 18:45 UTC

    Maybe also check the close

    close FH or warn "close failed!";

    (close only returns true if IO buffers were successfully flushed)