in reply to Doing more than printing "File Not Found" with a die command
Or if you want to do more than just one statement but don't want to dedicate a whole sub to error handling:
unless( open( ARCHIVE, ">>blah" ) ) { warn "Aiieeeee, can't append to blah!\n"; $no_archive = 1; update_fleezle( -42 ); open( ARCHIVE, ">&STDOUT" ) or die "Can't dup STDOUT: $!\n"; }
|
|---|