This is my first go a poetry, in a newly aquired language (I'm an ex awk man). Any suggestions?
use strict; my $lamb = { "size" => "little", "fleece" => "snow", }; my $mary = $lamb; # Mary has a little lamb, # whose fleece was white as snow $lamb = \$mary; # and everywhere that mary goes undef $lamb; # the lamb was sure to go

Replies are listed 'Best First'.
Re: Mary had a.......
by djantzen (Priest) on Mar 14, 2003 at 05:29 UTC

    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
      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.