Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How is it that I am able to see the unqualified $var variable from within the Bar package, as shown below (last line)?
#!/usr/bin/env perl use Modern::Perl; package Foo; our $var = 42; # This is $Foo::var. # Change the current package. package Bar; # This works, as expected. say "\$Foo::var: $Foo::var"; # But why does this work? $var is not in package Bar, # and we are in package Bar here. say "\$var: $var"; # !?
|
|---|