I'm influenced by Lisp's
With-Open-File forms in wanting this code to look more like:
open my $log, '>>', $logfile and do {
# lots of stuff to log
1;
} || do {
print "Failed to write log file $logfile: $!\n";
die "Failed to write log file $logfile: $!\n";
}
This has the interesting attribute that if the first
do-block does not return true, the error handling block runs for it, possibly allowing multiple error types to be more-or-less gracefully handled together.
For many things that's a benefit (but certainly not always)