Maybe I am going about this wrong, but I think there should be a way to do this. I want to have a hash of array reference so I have the following code snippet: <OUTSIDE LOOP> undef(@selections); while ((my $choice) = $sth->fetchrow_array()) { push(@selections,$choice); } $selections{$_} = \@selections; <END OUTSIDE LOOP> The result of this is that when I undef the array to clear in preparation for the next iteration, I also undef the ref from the previous iteration(s). Then the next ref is created and all values in the hash are the same reference which happens to be the last reference used. So, how do I build an array, put the ref into a hash and then loop back again so I can build up the next array to make a ref to put in the hash and so on.
In reply to Array Ref Problem by jonjacobmoon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |