use strict.pm is "scoped" so that it won't affect another file, even if you include it with require and it doesn't have a package statement. That causes the two file scopes to share the same package globals. But they don't share non-global things such a my variables or the settings from use strict.pm.
Update: Also, use vars marks a variable as OK to strict.pm by tagging it as having been "imported". So use vars qw(%hash); "imports" %hash into the main:: package so that any use of %hash in the main:: package will not generate an error, even if that use was done from within another file.
our doesn't mark %main::hash as having been imported but instead makes a lexical %hash (much like what my %hash does) that is aliased to %main::hash. So this won't affect other files that use %hash while in package main::. If you put our inside a block, then it won't even affect uses of %hash outside of that scope (but this is often a bad idea).
- tye (but my friends call me "Tye")In reply to (tye)Re: our/my inconsistency.
by tye
in thread our/my inconsistency.
by boo_radley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |