package Person; sub new { my $type = shift; my $class = ref $type || $type; my $self = { @_ }; bless $self, $class; $self; } sub name { shift->{NAME} } #### package Male; @Male::ISA = qw/Person/; sub new { my $type = shift; my $class = ref $type || $type; my $self = $class->SUPER::new(@_); $self->{GENDER} = "male"; $self; } sub gender { shift->{GENDER} } #### package main; my $him = new Male(NAME => "Foo Bar"); print "\$him is in the class '", ref $him, "'\n"; print $him->name, " is of the gender ", $him->gender, "\n"; #### $him is in the class 'Male' Foo Bar is of the gender male