package Animal; sub new { my $class = shift; my $self = {}; bless ($self, $class); return $self; } 1; ------------------------------------------------------------------- package Cat; use strict; use Animal; our @ISA = qw(Animal); sub speak { print "meow...\n"; } 1; ------------------------------------------------------------------- package Dog; use strict; use Animal; our @ISA = qw(Animal); sub speak { print "woof...\n"; } 1; --------------------------------------------------------- #!/usr/bin/perl use strict; use warnings; use Dog; use Cat; my $dog = Dog->new(); my $cat = Cat->new(); $dog->speak; $cat->speak;