#!/user/bin/perl -w use strict; ############################ ############################ package Animal; { sub animalmethod { my ($self)=@_; print "I´m an animal. My name is $self->{Name}. I´m $self->{Age} years old\n"; } } package Horse; { our @ISA=("Animal"); sub new { my ($class, $name, $age) = @_; my $ref = {Name=>$name, Age=>$age}; bless($ref, $class); } sub present { my ($self)=@_; if($self->isa("Animal")) { print "I'm an animal.\n"; } else { print "I'm not an animal.\n"; } } } package main; my $horse1 = Horse->new("George the Horse", 12); $horse1->present(); $horse1->animalmethod();