print "a Horse goes neigh!\n";
}
sub Sheep::speak {
- print "a Sheep goes baaaah!\n"
+ print "a Sheep goes baaaah!\n";
}
Cow::speak;
print "a Horse goes neigh!\n";
}
sub Sheep::speak {
- print "a Sheep goes baaaah!\n"
+ print "a Sheep goes baaaah!\n";
}
@pasture = qw(Cow Cow Horse Sheep Sheep);
sub sound { "moooo" }
sub speak {
my $class = shift;
- print "a $class goes ", $class->sound, "!\n"
+ print "a $class goes ", $class->sound, "!\n";
}
}
sub sound { "neigh" }
sub speak {
my $class = shift;
- print "a $class goes ", $class->sound, "!\n"
+ print "a $class goes ", $class->sound, "!\n";
}
}
{ package Animal;
sub speak {
my $class = shift;
- print "a $class goes ", $class->sound, "!\n"
+ print "a $class goes ", $class->sound, "!\n";
}
}
{ package Animal;
sub speak {
my $class = shift;
- print "a $class goes ", $class->sound, "!\n"
+ print "a $class goes ", $class->sound, "!\n";
}
}
{ package Horse;
{ package Animal;
sub speak {
my $class = shift;
- print "a $class goes ", $class->sound, "!\n"
+ print "a $class goes ", $class->sound, "!\n";
}
sub name {
my $self = shift;