@@ -17,8 +17,8 @@ Synopsis 5: Regexes and Rules
17
17
18
18
Created: 24 Jun 2002
19
19
20
- Last Modified: 29 Dec 2011
21
- Version: 152
20
+ Last Modified: 25 Feb 2012
21
+ Version: 153
22
22
23
23
This document summarizes Apocalypse 5, which is about the new regex
24
24
syntax. We now try to call them I<regex> rather than "regular
@@ -1204,17 +1204,12 @@ the lexical scope; if the match succeeds they are remembered in the
1204
1204
C<Match> object's hash, with a key corresponding to the variable name's
1205
1205
identifier. Likewise bound numeric variables persist as C<$0>, etc.
1206
1206
1207
- The capture performed by C<=> creates a new lexical variable if it does
1208
- not already exist in the current lexical scope. To capture to an outer
1209
- lexical variable you must supply an C<OUTER::> as part of the name,
1210
- or perform the assignment from within a closure.
1207
+ You may capture to existing lexical variables; such variables may
1208
+ already be visible from an outer scope, or may be declared within
1209
+ the regex via a C<:my> declaration.
1211
1210
1212
- $x = [...] # capture to our own lexical $x
1213
- $OUTER::x = [...] # capture to existing lexical $x
1214
- [...] -> $tmp { let $x = $tmp } # capture to existing lexical $x
1215
-
1216
- Note however that C<let> (and C<temp>) are not guaranteed to be thread
1217
- safe on shared variables, so don't do that.
1211
+ my $x; / $x = [...] / # capture to outer lexical $x
1212
+ / :my $x; $x = [...] / # capture to our own lexical $x
1218
1213
1219
1214
=item *
1220
1215
0 commit comments