http://qs1969.pair.com?node_id=827537


in reply to the ref use the same memory when i push structure onto array? Gahh .. please help me dear perl-gurus

you could also just add a my $rr; at the top of the loop to make sure you where starting with a new $rr everytime through. You could also use hash slices to simply the split a little

foreach (@rooms) { my $rr; @$rr{ qw/TITLE TEXT EXITS THINGS ITEMS/ } = split ":", $_; push @a, $rr; }; return \@a;


___________
Eric Hodges
  • Comment on Re: the ref use the same memory when i push structure onto array? Gahh .. please help me dear perl-gurus
  • Select or Download Code