Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: my vs. local subtlety

by ysth (Canon)
on Jul 03, 2006 at 22:24 UTC ( #559059=note: print w/replies, xml ) Need Help??


in reply to Re: my vs. local subtlety
in thread my vs. local subtlety

I thought it might be helpful to others to note the subtle "gotcha" between defining variables with "my" and with "local" when using a construct such as $$ctm.

Or a construct such as $#$arrnm or $$arrnm[$$ctm]. That is to say, your @out_a, etc. arrays also cannot be lexical (my) variables.

The distinction isn't between my and local, it's between lexical and package variables. Symbolic refs (which look up a variable by an expression giving it's name) always find package variables, not lexical ones.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://559059]
help
Chatterbox?
[LanX]: ... though there seems to exist a taxation for the letter 't' in Northern Bri''ain ;-)
[LanX]: never seen trainspotting in OV ... :(
[karlgoethebier]: LanX
[LanX]: They should teach Scottish in continental schools after Brexit !!!

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2018-02-19 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (262 votes). Check out past polls.

    Notices?