On 11/30/2013 4:07 AM, Lars Noodén wrote:
perlre(1) seems to be missing information about substitution evaluations
with the /e option. The functionality is present in perl:
perl -e '$_=2; s/2/1+3/e; print'
But it is not listed in the pod documentation for v5.16.3 or v5.18.1.
The modifier /e is described in "Programming Perl", 4th ed, pp 186,
254-255.
Where should suggestions for corrections be sent?
Could something like the text below be added?
Regards,
/Lars
$ diff perlre.pod perlre.pod.orig
108,113d107
< =item e
< X</e>
<
< Treat the replacement portion as an interpreted expression.
< Each additional C</e> modifier after the first functions as an eval()
around the code to execute.
<
See the substitution operator in perlop:
|||<http://perldoc.perl.org/functions/s.html>| A |/e| will cause the
replacement portion to be treated as a full-fledged Perl expression and
evaluated right then and there. It is, however, syntax checked at
compile-time. A second |e| modifier will cause the replacement portion
to be |eval <http://perldoc.perl.org/functions/eval.html>|ed before
being run as a Perl expression.
...
Here's the cross ref. in perlre:
For reference on how regular expressions are used in matchings of
"m//",
operations, plus various examples of the same, see discussions of
"m//",
"s///", "qr//" and "??" in "Regexp Quote-Like Operators" in
perlop.ls of
Modifiers quoted constructs" in perlop
--
Charles DeRykus
--
Charles DeRykus