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

Re^6: "eval" and "my" variable weirdness

by ikegami (Patriarch)
on Jun 29, 2006 at 17:32 UTC ( [id://558397]=note: print w/replies, xml ) Need Help??


in reply to Re^5: "eval" and "my" variable weirdness
in thread "eval" and "my" variable weirdness

It *is* optimized away (according to Deparse), but not before satisfying our needs. The safe version would be:

{ use warnings; my $thingy = 'thangy'; sub doit { no warnings 'void'; $thingy; # Close over $thingy eval 'print "thingy is $thingy\n"'; } } doit(); # "thingy is thangy"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found