my $fh = undef; open $fh, ">", "somefile" or die "Failed to open somefile. $!"; print $fh "Test\n";