Do you know where your variables are? | |
PerlMonks |
Re: Re: Re: Mysterious for behaviorby Belgarion (Chaplain) |
on Apr 21, 2004 at 20:00 UTC ( [id://347115]=note: print w/replies, xml ) | Need Help?? |
Maybe a better way to think about it is that you created an array of three elements, each element is pointing to the $i variable. However, because you are initializing $i for each element in the list, the elements in the list all contain the same value (in this case, the final value of $i: 1), since they're pointing to the current value of $i.
In Section
Seekers of Perl Wisdom
|
|