# file P1.pm package P1; sub new { my $class = shift; return bless {} => $class } sub A1 { print "i am A1 in P1\n"; } sub A2 { print "i am A2 in P1\n"; } 1; #### # file P2.pm package P2; use parent 'P1'; sub new { my $class = shift; return bless {} => $class } sub A1 { print "i am A1 in >>>P2<<< (i have overwritten previous A1)\n"; } # A2 and everything else are inherited from class P1 1; #### # file test.pl # run: perl -I. test.pl use P2; # and not P1 my $P2obj = P2->new(); $P2obj->A1(); # this is overwritten $P2obj->A2(); # this is inherited verbatim from parent P1