package House; sub new { my $class = shift; my $self = { id => $_[0], name => $_[1], detail => $_[2], }; bless $self, $class; return $self; } #### use House; . . . %houserooms = ( kitchen => { House->new("1","kitchen","sleek and modern") } den => { House->new("2","den","board games and more") } ); . . . etc #### my $roomcmd = <>; #this def does not print and I am not sure why or how to make it print the details print $houserooms{$roomcmd}->{detail};