Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Closure Over Scalar?

by choroba (Archbishop)
on Feb 18, 2021 at 15:57 UTC ( #11128525=note: print w/replies, xml ) Need Help??


in reply to Closure Over Scalar?

my with an assignment is tricky. The declaration of the variable happens at compile time, but the assignment happens at runtime. In this case, the assignment happens after the loop. So, when running the loop, the variable has been declared, but hasn't been assigned to. You need to move the closure block before the loop.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2021-05-14 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (148 votes). Check out past polls.

    Notices?