From 'perldoc -f our'
An "our" declaration declares a global variable that will be visible a +cross its entire lexical scope, even across package boundaries.
So any variable initialized with my or our is in this case within file scope. Wrap the instantiation of $d within a block to make the scope smaller:
package A; package B; { our $d = 1; } package C; package D; # now you have to use the package name to access the var print $B::d;
In reply to Re: Perl syntax
by stevieb
in thread Perl syntax
by PerlOnTheWay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |