in reply to Updating 1 array affects the other array
Because your two arrays are complex, this does not copy the structure and content, but only copy the corresponding reference. So the value $n in @array2 actually points to the value $n in @array1.$array2[$n] = $array1[$n];
for my $i (0..$#array1) { for my $j (0..$#array2) { # do something } }
|
|---|