Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Closure Over Scalar?

by choroba (Cardinal)
on Feb 18, 2021 at 15:57 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found