in reply to Mary had a.......

Not bad, although assignment differs strongly from containment, so you wouldn't really want to say "Mary is the lamb" (my $mary = $lamb). How about this?

use strict; use warnings; my ($mary, $lamb) = (bless({}, 'Girl'), bless({}, 'Lamb')); push(@{$mary->{possessions}}, $lamb); $lamb->{attributes} = { size => 'little', fleece => 'white as snow' }; $lamb->{location} = \$mary->{location}; # And to test... $mary->{location} = 'town'; use Data::Dumper; print Dumper $mary, $lamb;


"The dead do not recognize context" -- Kai, Lexx

Replies are listed 'Best First'.
Re: Re: Mary had a.......
by awkmonk (Monk) on Mar 14, 2003 at 09:29 UTC
    Ah, good man. A quick read through the old Camel, and I get your point. It's a bit more 'objecty' than I would normally go in for, but these distinctions all help to build the knowledge. Thanks for that.