summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-06-15 11:37:55 +0100
committerDavid Mitchell <davem@iabyn.com>2012-06-15 12:16:23 +0100
commitfa9b868604af313ce6bbe99553037346fabea66c (patch)
tree022f76305f0972c35c3ca47539dab22e6f70ac80 /pod/perlop.pod
parent27200c0ca41ae8a34637bf8237d5298ee525067c (diff)
downloadperl-fa9b868604af313ce6bbe99553037346fabea66c.tar.gz
point out another use for //o
Sometimes patterns with embedded code are recompiled each time even if the pattern string hasn't changed.
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod12
1 files changed, 12 insertions, 0 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index ced33b081c..3edeabd986 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1734,6 +1734,18 @@ you want the pattern to use the initial values of the variables
regardless of whether they change or not. (But there are saner ways
of accomplishing this than using C</o>.)
+=item 3
+
+If the pattern contains embedded code, such as
+
+ use re 'eval';
+ $code = 'foo(?{ $x })';
+ /$code/
+
+then perl will recompile each time, even though the pattern string hasn't
+changed, to ensure that the current value of C<$x> is seen each time.
+Use C</o> if you want to avoid this.
+
=back
The bottom line is that using C</o> is almost never a good idea.