diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-06-18 14:23:57 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-06-18 14:28:49 -0600 |
commit | 798dc914c398c7c040331cbc085457859797cc6f (patch) | |
tree | df9e1c3d583e50801250bf66e154efecce21411c /pod | |
parent | d98532ea8ab5685c2884f540fd890ca6efb50d94 (diff) | |
download | perl-798dc914c398c7c040331cbc085457859797cc6f.tar.gz |
perlfunc: Add caveat about string eval containing NV scalar
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 2e603cabc4..4562b2c905 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1777,7 +1777,8 @@ X<error, handling> X<exception, handling> =for Pod::Functions catch exceptions or compile and run code -In the first form, the return value of EXPR is parsed and executed as if it +In the first form, often referred to as a "string eval", 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 as a block within the lexical context of the current Perl @@ -1800,6 +1801,12 @@ scope that is still compiling. See also the L</evalbytes> keyword, which always treats its input as a byte stream and works properly with source filters, and the L<feature> pragma. +Problems can arise if the string expands a scalar containing a floating +point number. That scalar can expand to letters, such as C<"NaN"> or +C<"Infinity">; or, within the scope of a C<use locale>, the decimal +point character may be something other than a dot (such as a comma). +None of these are likely to parse as you are likely expecting. + In the second form, the code within the BLOCK is parsed only once--at the same time the code surrounding the C<eval> itself was parsed--and executed within the context of the current Perl program. This form is typically |