http://www.perlmonks.org?node_id=332891


in reply to inheritance turns back and bites

as others said already, in MyNumber, you have implemented the method add different from the one in SomeData. you have to decide which one you want.

also, in the new method of SomeData, you have a little error. if you do
sub new { bless \pop, shift }
it's like doing
sub new { bless \42, "MyNumber" }
and you can't bless a constant into an object. so do my $arg = pop; bless \$arg, shift