in reply to how to declare a package variable

....

"globally" means in current package (main by default)

$::foo is shorthand for $main::foo

So you have two globals ($P::A/$main::A) and a lexical ($A)

If you use warnings you'll get a warning about "my $A" being made invisible by "our $A" ( "our" variable $A masks earlier declaration in same scope )

Tutorials: Variables and Scoping: Coping with Scoping, Lexical scoping like a fox