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?? |
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]
In Section
Seekers of Perl Wisdom
|
|