summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorBram <perl-rt@wizbit.be>2008-07-24 20:14:27 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-08-24 14:52:12 +0000
commit777723442a58c6c86c224d8d746a30441a5bdfbd (patch)
tree45abacfc91df8bbbad01c3db7771db22c96333e9 /pod
parent228ee848f02d1db8db39c97ee13c0c9975afa083 (diff)
downloadperl-777723442a58c6c86c224d8d746a30441a5bdfbd.tar.gz
Unintented interpolation of $/ in regex (was: Re: [perl
Message-ID: <20080724181427.aiml4sdvr40k4coc@horde.wizbit.be> Note that the Subject: has a typo - it should be $\ This adds a new warning. I moved the tests from the original patch to t/lib/warnings/toke. p4raw-id: //depot/perl@34224
Diffstat (limited to 'pod')
-rw-r--r--pod/perldiag.pod14
1 files changed, 14 insertions, 0 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index c5125598bf..775e274ffc 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -3419,6 +3419,20 @@ but there was no array C<@foo> in scope at the time. If you wanted a
literal @foo, then write it as \@foo; otherwise find out what happened
to the array you apparently lost track of.
+=item Possible unintended interpolation of $\ in regex
+
+(W ambiguous) You said something like C<m/$\/> in a regex.
+The regex C<m/foo$\s+bar/m> translates to: match the word 'foo', the output
+record separartor (see L<perlvar/$\>) and the letter 's' (one time or more)
+followed by the word 'bar'.
+
+If this is what you intended then you can silence the warning by using
+C<m/${\}/> (for example: C<m/foo${\}s+bar/>).
+
+If instead you intended to match the word 'foo' at the end of the line
+followed by whitespace and the word 'bar' on the next line then you can use
+C<m/$(?)\/> (for example: C<m/foo$(?)\s+bar/>).
+
=item pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead
(D deprecated) You have written something like this: