use exceptions qw(open close); open(my $fh, '<', 'some_file'); # Throws exception on failure { no exceptions qw(open); open(my $other_fh, '<', 'some_other_file'); # fails silent close($fh); # This still throws an exception. no exceptions; # Turns off exceptions entirely. close($other_fh); # Fails silent. } close($yet_another_fh); # Throws exception on failure again.