in reply to Re: Re: passing information into a hash
in thread passing information into a hash
I usually stick with an explicit copy since it tends to keep me out of trouble, but there are times when you do want to take a reference, and you just have to be careful when you do.use Data::Dumper; my @array = qw(foo bar baz); my %hash; for (1..5) { my @array = qw(foo bar baz); $hash{$_} = \@array; undef @array; } print Dumper \%hash; for (1..5) { my @array = qw(foo bar baz); $hash{$_} = [@array]; undef @array; } print Dumper \%hash;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 3Re: passing information into a hash
by hmerrill (Friar) on Sep 29, 2003 at 17:08 UTC | |
by jeffa (Bishop) on Sep 29, 2003 at 19:00 UTC |