in reply to my $var masked across package scope?

There's an awesome and often unused tool that comes with perldoc that will just tell you about particular Perl keywords. Using "perldoc -q my" will tell you that,

A "my" declares the listed variables to be local (lexically) to the e +nclosing block...
So, enclosing your variable declarations inside of different blocks resolves the problem. Here's a more involved example:
#!/usr/bin/env perl + + use strict; use warnings; package Foo; { my $package = __PACKAGE__; sub new { return bless {'PACKAGE'=>$package} } } package Bar; { my $package = __PACKAGE__; sub new { return bless {'PACKAGE'=>$package} } } package main; my $foo = Foo->new; my $bar = Bar->new; print $foo->{'PACKAGE'}; print qq|\n\n|; print $bar->{'PACKAGE'};

Celebrate Intellectual Diversity