summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-11-24 14:32:50 -0500
committerDavid Golden <dagolden@cpan.org>2010-11-24 14:32:50 -0500
commit725a61d709bfdf8b3423a1409027c3ea9cd0c4f9 (patch)
treecc8cc1389f2d1d818c9cb6fc885a431e090cbc95 /pod/perlop.pod
parentd59a8b3e000058b06c6c29b782826d702b04630a (diff)
downloadperl-725a61d709bfdf8b3423a1409027c3ea9cd0c4f9.tar.gz
Deprecate ?PATTERN? without explicit m operator
Deprecate ?PATTERN?, recommending the equivalent m?PATTERN? syntax, in order to eventually allow the question mark to be used in new operators that would currently be ambiguous. (With minor reconciliation edits by David Golden) Signed-off-by: David Golden <dagolden@cpan.org>
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod29
1 files changed, 17 insertions, 12 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 1b258c0926..b31b9bec99 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1357,11 +1357,12 @@ process modifiers are available:
g Match globally, i.e., find all occurrences.
c Do not reset search position on a failed match when /g is in effect.
-If "/" is the delimiter then the initial C<m> is optional. With the
-C<m> you can use any pair of non-whitespace characters as delimiters.
-This is particularly useful for matching path names that contain "/",
-to avoid LTS (leaning toothpick syndrome). If "?" is the delimiter,
-then the match-only-once rule of C<m?PATTERN?> applies (see below).
+If "/" is the delimiter then the initial C<m> is optional. With the C<m>
+you can use any pair of non-whitespace characters
+as delimiters. This is particularly useful for matching path names
+that contain "/", to avoid LTS (leaning toothpick syndrome). If "?" is
+the delimiter, then a match-only-once rule applies,
+described in C<m?PATTERN?> below.
If "'" is the delimiter, no interpolation is performed on the PATTERN.
When using a character valid in an identifier, whitespace is required
after the C<m>.
@@ -1526,10 +1527,10 @@ Here is the output (split into several lines):
lowercase line-noise MiXeD line-noise. That's all!
=item m?PATTERN?
-X<?>
+X<?> X<operator, match-once>
-This is just like the C<m/pattern/> search, except that it matches only
-once between calls to the reset() operator. This is a useful
+This is just like the C<m/PATTERN/> search, except that it matches
+only once between calls to the reset() operator. This is a useful
optimization when you want to see only the first occurrence of
something in each file of a set of files, for instance. Only C<m??>
patterns local to the current package are reset.
@@ -1539,12 +1540,16 @@ patterns local to the current package are reset.
# blank line between header and body
}
} continue {
- reset if eof; # clear ?? status for next file
+ reset if eof; # clear m?? status for next file
}
-The use of C<?PATTERN?> without a leading "m" is vaguely deprecated,
-which means it just might possibly be removed in some distant future
-version of Perl, perhaps somewhere around the year 2168.
+The match-once behaviour is controlled by the match delimiter being
+C<?>; with any other delimiter this is the normal C<m//> operator.
+
+For historical reasons, the leading C<m> in C<m?PATTERN?> is optional,
+but the resulting C<?PATTERN?> syntax is deprecated, will warn on
+usage and may be removed from a future stable release of Perl without
+notice.
=item s/PATTERN/REPLACEMENT/msixpogcer
X<substitute> X<substitution> X<replace> X<regexp, replace>