open my $FH, '>', 'whatever' or warn 'blah'; # much much later if ($FH) { print $FH "something }