eval { open(FH, $file) or die "NO_OPEN"; $text = join('', ) or die "NO_READ"; close(FH) or die "NO_CLOSE"; } if ($@) { ... }