open my $fh, '>', 'foo.txt' or die "Ouch. $!"; print {$fh} "hi!\n"; close $fh;