in reply to Updating 1 array affects the other array
then if you make this:@array1=( [1,2,3], [4,5,6], [7,8,9] );
and change value in $array1$array2[1]=$array1[1]
you will get$array1[1][0]='something';
the $array21 is virtually have the same memory space with corresponding value in @array1, because the thing stored in $array1 is actually a reference to the anonymous list 4,5,6. So, what you give to array2 is the same reference, but not the values.print $array2[1][0]; # shows 'something'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Updating 1 array affects the other array
by iphony (Acolyte) on Sep 02, 2008 at 12:24 UTC | |
by JadeNB (Chaplain) on Sep 02, 2008 at 14:29 UTC |