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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Mary had a.......
by awkmonk (Monk) on Mar 14, 2003 at 09:29 UTC |