my $fname_out = 'name.txt'; open my $OUTFILE, '>', $fname_out or die "Couldn't open $fname_out: $!"; #and then... print $OUTFILE "whatever";