in reply to Re: Increment by 2 and by 1 in same loop.
in thread Increment by 2 and by 1 in same loop.
It's also possible to define (and initialize, if needed) two (or more) lexical loop variables entirely locally:
for (my ($i, $n) = (1, 2); $i < $limit; $i += 2, ++$n) { do_something_with($i, $n); }
|
---|
In Section
Seekers of Perl Wisdom