Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Usage of 'my' in 'eval'

by Perl Mouse (Chaplain)
on Jan 06, 2006 at 11:43 UTC ( #521449=note: print w/replies, xml ) Need Help??


in reply to Usage of 'my' in 'eval'

An eval provides its own 'scope', so anything lexical you do is limited to that scope.

But even if it weren't, it wouldn't do you much good. The biggest effect 'my' has is at compile time - it tells the compiler you have a lexical variable. However, the eval happens at run time - if you'd use '$a' after the eval, '$a' is unknown at compile time (so, if 'use strict' is in effect, it will complain).

Perl --((8:>*

Replies are listed 'Best First'.
Re^2: Usage of 'my' in 'eval'
by Anonymous Monk on Jan 06, 2006 at 12:08 UTC

    I was afraid it'd be so!

    Thank you very much for the quick help!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2020-10-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (208 votes). Check out past polls.

    Notices?