use strict;
package foo;
our $bar = 1;
# at this point, using $bar could mean TWO things:
# 1) try to access the global $foo::bar
# 2) try to access the alias named $bar for $foo::bar
# The lexical (second) one wins in perl, so you don't
# get a use strict error
print $bar;
package baz;
# Now $bar could mean:
# 1) try to access the global $baz::bar
# 2) try to access the alias named $bar for $foo::bar
# The lexical (second) one still wins.
print $bar; # works, prints $foo::bar even though we are in baz
####
use strict;
package foo;
use vars qw/$bar/;
$bar = 1;
# $bar has only one meaning, access $foo::bar
print $bar;
package baz;
# $bar has only one meaning, access $baz::bar
print $bar; #error
####
package foo;
print $bar; # prints the global $foo::bar
package baz;
print $bar; # prints the global $baz::bar