Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Iterating over code embeded in regex

by ioannis (Parson)
on Jun 13, 2006 at 05:34 UTC ( #554954=note: print w/ replies, xml ) Need Help??

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

Comment on Re: Iterating over code embeded in regex
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://554954]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-11-29 13:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls