Both times that the loop is run, \@a returns a reference to the same array, because it is the same array that's on the right of the \ character.
To avoid that, you can use $h{$i} = [@a] instead, which copies the array and returns a reference to the copy.
In reply to Re: help with references
by moritz
in thread help with references
by dw_perlmonks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |