I just don't really conceptually get why the first iteration works but after that I get a shallow copy.
You never get a copy of the array referenced by $data2, not even the first time through the loop. Every time through the loop you set $r->{sizes} to be a reference to the same original anonymous array. If you want a new array you have to create it. util has shown you several ways you can make a copy of the array referenced by $data2. Having created a copy of the original array, you can then set $r->{sizes} to be a reference to the copy.
In reply to Re^5: Strange hash array behavior
by ig
in thread Strange hash array behavior
by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |