Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: my and local differences

by redcloud (Parson)
on Nov 10, 2000 at 23:10 UTC ( #40998=note: print w/replies, xml ) Need Help??

in reply to my and local differences

Always use my unless you need to use local.

Time when you need to use local include:

  • On "punctuation" variables (for example, $_)
  • When you want to access the localized variable in a subroutine that you call from inside that scope.

Replies are listed 'Best First'.
RE: Re: my and local differences
by Fastolfe (Vicar) on Nov 10, 2000 at 23:20 UTC
    Instead of mentioning the punctuation variables, I usually tell people "use local whenever you want to mask a global variable with a localized value". The "punctuation variables" are examples of global variables that you might want to change the values of in a particular scope.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://40998]
[Corion]: Nice to see that the kids have some understanding of important things that happen and the appropriate behaviour :)
[marto]: at times mine surprise me with this behavior :)
[Corion]: I mean, in a way it would be nicer+easier if they always where that obedient, but it's comforting to see that they are when it matters, at least for now ;)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2016-12-08 09:28 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (138 votes). Check out past polls.