package Tie::Static; $VERSION = 0.01; foreach my $type (qw(Hash Array Scalar)) { my $meth = uc($type); eval qq( package Tie::Static::$type; require Tie::$type; \@ISA = 'Tie::Std$type'; sub Tie::Static::TIE$meth { my \$id = join "|", caller(), \@_; return \$preserved{\$id} ||= Tie::Static::$type->TIE$meth; } ) or die $@; } 1; #### tie (my $foo, 'Tie::Static'); tie (my $bar, 'Tie::Static'); # or this map { tie $_, 'Tie::Static' } my ($foo, $bar, $baz, ...);