As an alternative, you could first check via -f $file that the file exists and return with a warning if it does not exist and die only if it exists yet the open fails.
But that is a race condition :) The file could become exist after you check with -f
use Errno ;
open ... or do { if( $!{ENOENT} ){ warn "Uh oh '$file': $!" ; return; } die "Uh oh, unexpected '$file': $!"; }
In reply to Re^2: unless vs. bare block
by Anonymous Monk
in thread unless vs. bare block
by chayashida
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |