my @array=(1..10); for my $i (@array){$i++;} print \"array is now:@array\";
this is changing the values of the array. Why?
The loop variable $i is aliased to each element in the array in turn.
$i
That means that if you change $i you're changing the array.