package A; sub new { my $type = shift; my $self = { INDEX => 0 }; bless $self, $type; } sub doIncrement { my $self = shift; $self->INDEX} += 1; } package B; @B::ISA = ('A'); sub main { my $b = B->new(); $b->INDEX} = 0; $b->doIncrement(); print 'b index: ' . $b->INDEX} . "\n"; } main();