On May 17, [EMAIL PROTECTED] said:
> $<digits>
> Contains the subpattern from the corresponding set
> of parentheses in the last pattern matched, not
> counting patterns matched in nested blocks that have
> been exited already. (Mnemonic: like \digits.)
> These variables are all read-only.
>
>I don't understand the second part ==> "not counting patterns matched in
>nested blocks that have been exited already." Could I get some example
>illustrating this point?
I believe it refers to using (??{ ... }) which is a new feature to Perl
5.6's regex engine.
$_ = "foo bar blat";
$re = qr/(\w+)/; # create a compiled regex object
/(\w+)\s*(??{ $re })\s*(\w+)/
print "<$1> <$2> <$3>\n";
Even though the (??{ $re }) sequence has a (\w+) in it, that () is the $1
INSIDE the (??{ ... }), and it goes away when that nested block is left.
Thus, the program prints "<foo> <blat> <>", and the (\w+) inside $re is
"lost", as far as we're concerned.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
*** I need a publisher for my book "Learning Perl Regular Expressions" ***