package Bar; %fizzle = ( Password => 'XYZZY' ); sub new { my $type = shift; my $self = {}; $self->{fizzle} = \%fizzle; return bless $self, $type; } sub enter { my $self = shift; # Don't try to guess if we should use %Bar::fizzle # or %Foo::fizzle. The object already knows which # we should use, so just ask it. # my $fizzle = $self->{fizzle}; print "The word is ", $fizzle->{Password}, "\n"; } package Foo; @ISA = qw( Bar ); %fizzle = ( Password => 'Rumple' ); sub new { my $type = shift; my $self = Bar->new; $self->{fizzle} = \%fizzle; return bless $self, $type; } package main; $a = Bar->new; $b = Foo->new; $a->enter; $b->enter;