in reply to Iterating over code embeded in regex
The snippet bellow shows that the $l inside the embedded code
of the regex is a closure.
use Scalar::Util 'refaddr'; for my $l ('a'..'b') { print 'loop variable ', refaddr \$l; $l =~ /(?{ print refaddr(\$l) }) /x; }
Here is the output:
loop variable 135603848 135606104 loop variable 135606092 135606104
|
---|
In Section
Seekers of Perl Wisdom