Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: Help needed understanding global variables in Perl

by arturo (Vicar)
on Mar 06, 2002 at 18:14 UTC ( #149770=note: print w/replies, xml ) Need Help??


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'.
Re^4: Help needed understanding global variables in Perl
by Anonymous Monk on Feb 02, 2017 at 15:04 UTC
    Hence why you shouldn't use "use strict".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://149770]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2017-06-26 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.