my $foo; sub bar {} #### package Foo; our $Bar; #### my $foo=1; # create an anonymous lexical and label it as $foo { my $foo=2; # create an new anonymous lexical and also label it $foo # this $foo will block the other $foo from being accessed # by name until we reach the end of scope print $foo,$/; } print $foo,$/; #prints 2 and 1; #--------------- our $Foo=1; # Tell Perl that its ok for us to access $Foo # without qualification, and give it 1 as a value. { our $Foo=2; # Tell Perl that its ok for us to access $Foo # without qualification, and give it 2 as a value. print $Foo,$/; } print $Foo,$/; # prints 2 and 2 #### # thess pragmata apply to everything below use strict; use warnings; package Foo; my $Bar; sub Foo{} package Bar; my $Bar; sub Bar{} sub Foo::Bar{} package Foo; sub Baz{} sub Bar{} __END__ "my" variable $Bar masks earlier declaration in same scope at D:\perl\devlib\Text\strict2.pl line 7. Subroutine Bar redefined at D:\perl\devlib\Text\strict2.pl line 12.