summaryrefslogtreecommitdiff
path: root/pod/perlre.pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-17 13:12:21 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-17 13:12:21 +0000
commit665e98b9987fe678dd115b56e9f0c9eb6bba0f1e (patch)
tree0e71dd436ef026602cc4fdfbdf63d1f873fb3c7a /pod/perlre.pod
parent7d4807dba83f8253564940c8bb1fc36759e49187 (diff)
downloadperl-665e98b9987fe678dd115b56e9f0c9eb6bba0f1e.tar.gz
DOCPATCH Re: $1 remains uncleared for failed matches
From: david nicol <whatever@davidnicol.com> Date: 16 Jun 2003 20:35:24 -0500 Message-Id: <1055813724.1580.19.camel@plaza.davidnicol.com> Subject: Re: DOCPATCH Re: $1 remains uncleared for failed matches From: Ronald J Kimball <rjk@linguist.Thayer.dartmouth.edu> Date: Tue, 17 Jun 2003 00:12:04 -0400 Message-ID: <20030617041204.GA34960@linguist.thayer.dartmouth.edu> p4raw-id: //depot/perl@19804
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r--pod/perlre.pod6
1 files changed, 5 insertions, 1 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index a11e3e833b..365cbb9aaa 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -394,11 +394,15 @@ the most-recently closed group (submatch). C<$^N> can be used in
extended patterns (see below), for example to assign a submatch to a
variable.
-The numbered variables ($1, $2, $3, etc.) and the related punctuation
+The numbered match variables ($1, $2, $3, etc.) and the related punctuation
set (C<$+>, C<$&>, C<$`>, C<$'>, and C<$^N>) are all dynamically scoped
until the end of the enclosing block or until the next successful
match, whichever comes first. (See L<perlsyn/"Compound Statements">.)
+B<NOTE>: failed matches in Perl do not reset the match variables,
+which makes easier to write code that tests for a series of more
+specific cases and remembers the best match.
+
B<WARNING>: Once Perl sees that you need one of C<$&>, C<$`>, or
C<$'> anywhere in the program, it has to provide them for every
pattern match. This may substantially slow your program. Perl