Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Local for lexicals

by JadeNB (Chaplain)
on Aug 10, 2009 at 15:35 UTC ( [id://787360]=note: print w/replies, xml ) Need Help??


in reply to Re: Local for lexicals
in thread Local for lexicals

The problem is that the inner my $e is a completely different variable to the outer one, so that functions closing over the outer one don't ‘see’ it. To illustrate:
perl -wMstrict -e 'my $e = 77; my $f = sub { warn $e }; $f->(); { my $ +e = 22; $f->() } $f->();'
gives
77 at -e line 1 77 at -e line 1 77 at -e line 1

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found