diff options
-rw-r--r-- | pod/perlfunc.pod | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index e0b8049abf..886aae9b30 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1625,6 +1625,22 @@ normally you I<would> like to use double quotes, except that in this particular situation, you can just use symbolic references instead, as in case 6. +The assignment to C<$@> occurs before restoration of localised variables, +which means a temporary is required if you want to mask some but not all +errors: + + # alter $@ on nefarious repugnancy only + { + my $e; + { + local $@; # protect existing $@ + eval { test_repugnancy() }; + # $@ =~ /nefarious/ and die $@; # DOES NOT WORK + $@ =~ /nefarious/ and $e = $@; + } + die $e if defined $e + } + C<eval BLOCK> does I<not> count as a loop, so the loop control statements C<next>, C<last>, or C<redo> cannot be used to leave or restart the block. |