My first guess would be,
that you give
bless the parameters in wrong order: So in package Duck,
sub new {
# shift means shift @_ and will have $_[0] inside
# what means $self like in package Animal
return bless(shift, {text => "I am a a duck.\n"});
# and the class name needs to be first parameter
}
So, you accidently blessed the class 'I am a duck.\n' instead of the class Duck :-)
But as 'I am a duck.\n'-class also @ISA Animal, it still could speak and speaks there $self->{text} that had never been defined anywhere, so it prints nothing at all absolutely correctly :D
Greetings,
Janek Schleicher