.. but I'm confused - this looks like (and testing seems to bear it out) that the contents of @loop will all be identical hashes (since they are all references to a single hash, %row).
Nope. Your tests are wrong. The original code gets a new %hash on each iteration of the loop since it's declared with my inside the loop. Your test declares a single hash and manipulates the values of that single hash. For the test to be similar to the original code, you'd need to use my on both assignments.
In reply to Re: Confused by reference sample code
by duff
in thread Confused by reference sample code
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |