Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Iterating over code embeded in regex

by ioannis (Prior)
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://554954]
help
Chatterbox?
[Lady_Aleena]: james28909, I use get_data in a subroutine called movies.
[Lady_Aleena]: james28909, I put it at the top of my scratchpad, if you want to look at it.
[Lady_Aleena]: I remember being pretty proud of that little sub when I wrote it.
[james28909]: oh xD

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-05-24 04:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?