in reply to
Re^2: Global variable vs passing variable from sub to sub
in thread Global variable vs passing variable from sub to sub
Let me put it this way and see if it makes more sense. I have a 11,000 line program. It has 10 globals at the top. Because they're global, this means that *any* single one of those 11,000 lines can modify that global value. Therefor, when your global has the *wrong* value, you have problems finding it, because you must examine 11,000 lines of code.
Using properly scoped lexicals, you might have a function that is only 10 lines long with a lexical declared at the top. Now you know only 10 lines total can affect that variable, thus vastly reducing the search space.
I think this is an extreme case where globals are used all over the place. Maybe they are cases like that.
I once had the unfortunate task of tweaking someone's script where not only were the variables global, they were also not declared with my. It was unpleasant, to say the least.
However, I think there's some justification for selective use of what meryln termed "regional" globals - globals used within a module (if I understood him correctly).