Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://559059]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2018-08-16 12:45 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (167 votes). Check out past polls.