Well, they are. Sort of.
our creates an alias to a package variable.
That is, our $foo is an alias to
$PACKAGE::foo, where PACKAGE
is your current package. The package variable will always
exist, but the alias is lexically scoped.
use strict;
$main::foo = 1;
{
our $foo;
print $foo, "\n";
}
# print $foo, "\n";
print $main::foo, "\n";
This prints 1\n1\n. But if you remove the
#, the code doesn't compile.
Abigail | [reply] [d/l] [select] |