|more useful options|
Re: Understanding why strict prevents a use of localby IraTarball (Monk)
|on Oct 20, 2001 at 01:10 UTC||Need Help??|
Just a comment. BTW I agree with the above comments that you whould avoid globals <e>especially</e> in long scripts.
But as and aside regarding use vars and our declarations. I don't believe they are quite equivalent. This might be splitting hairs, but a use vars declaration gives a package variable while an our declaration gives a global disguised as a my variable. This means the scoping is lexical for our variables. The following code
would not compile under strict. $variable is out of scope by the print statement. A use vars qw($variable); line would work however.
Another implication, if you are using packages to give different name spaces in the same file, a declaration like...
might not do what you expect. For example not run under strict. The vars variable $thing1 is a package variable, not available to the main package without a $one::thing1 type address. $thing2 however, the our declaration <e>is</e> available to the main package. It's scope is the same as my so is file wide in this sample.
I didn't get this when I first started using <cod>our</code> so I just wanted to throw it there since it seems to apply to this thread.
"So... What do all these little arrows mean?"