Do you know where your variables are? | |
PerlMonks |
Re^2: Are global variables "bad"?by gwadej (Chaplain) |
on Apr 22, 2009 at 16:55 UTC ( [id://759342]=note: print w/replies, xml ) | Need Help?? |
Perhaps a better way to say it is not that globals are bad, but that globals are easy to use badly. I often find that I am suspicious when I run across global variables (and now Singletons) in code that is larger than a single script. I know (from much painful experience) that the globals are likely to be the focus of surprising behavior from changes due to unrelated code. Personally, I learned this not from any CS classes, but from being bitten a few times too many.
G. Wade
In Section
Seekers of Perl Wisdom
|
|