From 2341804c04aefb306adfdbe22c23e6cd11f0e48f Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Mon, 6 Jun 2011 11:19:37 +0100 Subject: [PATCH] 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. --- pod/perlfunc.pod | 9 ++++++--- 1 file 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 X 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 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 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. -- 2.34.1