package Foo; our $var; $var = 10; #### package Foo; our $d; # FIRST $d = __PACKAGE__; package Bar; sub bar { print 'in ', __PACKAGE__, '::bar $d is equal to ', "$d\n"; return; } our $d = __PACKAGE__; # SECOND sub baz { print 'in ', __PACKAGE__, '::baz $d is equal to ', "$d\n"; return; } package main; Bar::bar(); Bar::baz(); __END__ poletti@PolettiX:~/sviluppo/perl$ perl our.pl in Bar::bar $d is equal to Foo in Bar::baz $d is equal to Bar #### Bar::baz()> is in the scope of the second.

In your example, you actually access $Bar::d #### our($d) = @_;