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

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone tell me why the method getName() returns "Shape=HASH(0x81073ec)->getName()"? Thanks Monks!



# Shape.pm package Shape; sub new { my $class = shift; my $self = { COLOR => "clear", LNGTH => "0", WIDTH => "0", NAME => "blank", @_, }; return bless $self, $class; } sub getName { my $self = shift; return $self->{NAME}; } 1; # in lego.pl use Shape; $circle = Shape->new( COLOR => "red", LNGTH => "2", WIDTH => "2", NAME => "barney" ); print "The color of \$circle is: $circle->getName()\n"; exit(0);