# cat x.pl ; perl-5.16.2 x.pl use strict; use warnings FATAL => 'all'; use 5.010; P::show(); Q::show(); R::show(); {{ package P; my $v = __PACKAGE__; BEGIN { $v .= ' ' . __LINE__; } sub show { say $v; } }} {{ package Q; our $v = __PACKAGE__; BEGIN { $v .= ' ' . __LINE__; } sub show { say $v; } }} {{ package R; BEGIN { our $v = __PACKAGE__ . ' ' . __LINE__; } our $v; sub show { say $v; } }} __END__ 13 21 R 28