in reply to Re^3: Quick easy question: What does $i mean?
in thread Quick easy question: What does $i mean?

... Assuming that $limit wasn't already defined as "whatever - 1". You're thinking of $limit strictly in terms of "scalar @array", which was not what I was thinking when I wrote that little snippet. :)
  • Comment on Re^4: Quick easy question: What does $i mean?

Replies are listed 'Best First'.
Re^5: Quick easy question: What does $i mean?
by ikegami (Patriarch) on Sep 23, 2005 at 23:20 UTC

    No, I was not assuming anything.

    for (my $i = 0; $i < $limit; ++$i)
    is not equivalent to
    for (0 .. $limit) { #... }
    but rather
    for (0 .. $limit-1) { #... }