http://www.perlmonks.org?node_id=1018653


in reply to Re: Dereference string in foreach
in thread Dereference string in foreach

Here is the effect when perl localizes a variable:

#Whoops.  An Anonymous Monk already posted a good example.

And because a for loop aliases each element in the array to the loop variable, changes to the loop variable change the elements of the array.