My goal was to use the same code to maintain separate variable stacks. The real sub needs to be called many times, each instance with its own arrays. My attempt at an object oriented solution has failed:

```
package pkg_magic;
sub new{my $pkg={}; bless $pkg; return $pkg;}

my $keep;
sub set{my $self=shift; $keep=shift;}
sub show{my $self=shift; print"$self $keep\r\n";}
1;

```

Called twice from:

```
#!/usr/bin/perl
use strict;
use warnings;

push(@INC,".");
use pkg_magic;

my $inst1=pkg_magic->new;
   $inst1->set("inst1");
   $inst1->show();
my $inst2=pkg_magic->new;
   $inst2->set("inst2");
# call first instance, not second
   $inst1->show();
exit;

```

Gives output of:

```
pkg_magic=HASH(0x2020f88) inst1
pkg_magic=HASH(0x2020f88) inst2

```

Obviously the same sub is being reached, even though it was called as a different object. If I copy the package code to separate files and rename the subs (set1, set2, etc) all works as hoped, so I was just trying to simplify code maintenance. Am I missing something above, or going in the wrong direction?