Do you know where your variables are? | |
PerlMonks |
Re: Are global variables "bad"?by BrowserUk (Patriarch) |
on Apr 22, 2009 at 00:17 UTC ( [id://759147]=note: print w/replies, xml ) | Need Help?? |
Saying "Global variables are bad!", is like saying "Drugs are bad!". Used wrongly they can be harmful. Used correctly they are a powerful good. And remember, entries in the symbol table are just global variables. So, if you substitute a 'singleton' instance, for a global variable, you are just substituting (at least) one global variable for another. And making your code far more complicated to boot. If you need global access to something, use a global variable. It's cleaner, clearer and safer. Like 'democracies' in which only one party is allowed, classes in which only one instance is allowed, are just a sham, putting a politically acceptable face on the truth. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|