in reply to Re: references--hard vs anonymous operational weirdness
in thread references--hard vs anonymous operational weirdness
Only if @array was declared outside the loop.</nit>
my @array; for my $tab ( @things ) { @array = frobnicate( $tab ); ## As you've seen, this leaves everything pointing at the same array $data{ $tab } = \@array; }
Were @array declared inside the loop you'd get a fresh instance each time through.
for my $tab ( @things ) { my @array = frobnicate( $tab ); $data{ $tab } = \@array; }
The cake is a lie.
The cake is a lie.
The cake is a lie.
In Section
Seekers of Perl Wisdom