Perl: the Markov chain saw | |
PerlMonks |
Re: evaluation strategy of perlby kabel (Chaplain) |
on Sep 20, 2002 at 14:14 UTC ( [id://199476]=note: print w/replies, xml ) | Need Help?? |
the problem here is that $i is declared only once and at the end of the for loop it has the value 3. i think what you want is something like this:
in each iteration a new variable $i is created. the old $i (from the former loop iteration) is no longer accessible via $i, but because there is a subroutine referencing it, it is not garbage collected.
In Section
Seekers of Perl Wisdom
|
|