diff options
author | David Mitchell <davem@iabyn.com> | 2011-06-06 11:19:37 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-06-06 11:19:37 +0100 |
commit | 2341804c04aefb306adfdbe22c23e6cd11f0e48f (patch) | |
tree | fe755365850c8e7006723e8a9d852e1d25d4ba62 /pod/perlfunc.pod | |
parent | 71edc89419f11505f2cdaba9b13be65582d7f011 (diff) | |
download | perl-2341804c04aefb306adfdbe22c23e6cd11f0e48f.tar.gz |
clarify eval $string scope in docs
[perl #88014] demonstrated that the docs for string eval misleadingly
implied that the code wasn't executed within new new block scope,
leading to false expectations that $1 etc would retain their values
outside the eval.
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r-- | pod/perlfunc.pod | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 91a19a2efd..54f5ae2830 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1592,9 +1592,12 @@ X<error, handling> X<exception, handling> In the first form, the return value of EXPR is parsed and executed as if it were a little Perl program. The value of the expression (which is itself determined within scalar context) is first parsed, and if there were no -errors, executed in the lexical context of the current Perl program, so -that any variable settings or subroutine and format definitions remain -afterwards. Note that the value is parsed every time the C<eval> executes. +errors, executed as a block within the lexical context of the current Perl +program. This means, that in particular, any outer lexical variables are +visible to it, and any package variable settings or subroutine and format +definitions remain afterwards. + +Note that the value is parsed every time the C<eval> executes. If EXPR is omitted, evaluates C<$_>. This form is typically used to delay parsing and subsequent execution of the text of EXPR until run time. |