http://qs321.pair.com?node_id=149770


in reply to Re: Re: Help needed understanding global variables in Perl
in thread Help needed understanding global variables in Perl

Yes, this is legal code. The answer to your question is that there *is* no mechanism in Perl for declaring global variables. The point of use strict is to force you to think about what you're doing when it comes to variables. It will not, however, prevent you from shooting yourself in the foot. Perl is just not that kind of language.

On the more general issue: tied up with the whole "global/local" thang is the notion of packages. 'Ave yourself a look at perldoc -f package while you're exploring these issues.

Finally, lemme recommend, as I have many times before, Dominus' "Coping with Scoping" (follow the link to his page and thence to his site) and, less enthusiastically, my own proposed scoping tutorial.

I mistrust all systematizers and avoid them. The will to a system shows a lack of integrity -- F. Nietzsche

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.