Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^4: Tk question

by PhilHibbs (Hermit)
on Sep 10, 2003 at 10:35 UTC ( #290360=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Tk question
in thread Tk question

'my' declares a variable within the 'current scope' - if that's in a sub (or any pair of braces),it's gone when you exit the sub. If, on the other hand, it's in the 'main body' of your code, it's global. That is generally a Bad Thing.
That makes it sound like using "my" at global scope is a Bad Thing. Shurely not?

Replies are listed 'Best First'.
Re^5: Tk question
by benn (Vicar) on Sep 10, 2003 at 11:04 UTC
    Yes, I think globals are a Bad Thing generally - not So Bad that I don't use them {g}, but it'll only ever be a couple ($dbh and $cgi, generally). I try to only use globals if it makes things more stylish, or efficient, or pretty. In a case like this, where it looks he's trying to make *every widget* global, that's almost definitely a Bad Thing, and is probably contributing to some 'code spaghetti'.

    Cheers, Ben.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://290360]
talexb finishes writing a Cranky Old Man post, and hopes it will be taken in the spirit intended. :)
[Corion]: We're happy to have you here, talexb!
[talexb]: Thanks. :)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2018-07-19 14:15 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (409 votes). Check out past polls.