#!/tps/bin/perl $logfilename = './test.log'; open (my $FH, '>', $logfilename) || die "CANNOT OPEN LOG"; print "\n\noutside FH\n\n"; select $FH; print "\n\n this is inside the FH\n\n"; select STDOUT; print "\n\n this is back outside the FH\n\n"; close($FH); $logfilename = './test2.log'; open (my $FH, '>', $logfilename) || do { print "test test test\n"; die "CANNOT OPEN LOG"; } print "\n\noutside FH\n\n"; select $FH; print "\n\n this is inside the FH\n\n"; select STDOUT; print "\n\n this is back outside the FH\n\n"; close($FH);