if (!open my $log_FH, '>', './testlogifle.txt') { print "Failure to open log file.\n"; die "Failure to open log file.\n"; }
Note that the lexical $log_FH in the quoted code is local to the if-block and cannot be used by anything except the open failure-handling code — probably not what GreenLantern intends. Instead, the lexical should be declared outside the block if it is ever to be used there.
Also, this might be a good occasion to use the otherwise puzzling idiom I see sometimes in bioinformatics code: wrapping the open in an unless-block:
my $log_FH; unless (open $log_FH, '>', './testlogifle.txt') { print "Failure to open log file.\n"; die "Failure to open log file.\n"; } do_something_with($log_FH); ...
Give a man a fish: <%-{-{-{-<
In reply to Re^4: Multiple actions triggered by failure to open a file
by AnomalousMonk
in thread Multiple actions triggered by failure to open a file
by GreenLantern
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |