Dear perl -gurus: i am new to perl and really have begun to love this stuff very quickly .. I have a data structure:
my $room = ( {
TEXT => $string,
EXITS => $exits,
THINGS => { %things },
ITEMS => { %items },
CMDS => { %cmds },
# EVENTS => \&events,
} );
I have a function that pass this ref, and then read some data into the strucrture and push it onto an array several passes, that I then return a ref to .. But I end up with the last (pass) element in all places in the array .. the ref use the same memory again and again? How can I make the ref a new one in each pass? When I print it out I get the correct strings for each pass .. so it must be the push that creates a problem.
foreach (@rooms)
{
($rr->{TITLE}, $rr->{TEXT}, $rr->{EXITS}, $rr->{THINGS
+}, $rr->{ITEMS}) = split ":", $_;
push @a, $rr;
};
return \@a;
Please, anyone, how to approach this problem? Thanks ..
^^^theantler<<<