in reply to Incrementing the loop again.

This is rather odd looking code for a number of reasons.

First it is very odd for the "for loop" variable, in this case, $i to have scope outside of the for loop. Normally these things are coded as:  for (my $i=0; $i <=100; $i++){} #after the "for loop", $i has no scope.

But as another point, in Perl, C Style "for loops" themselves are rare. Usually better coded as for my $i (0..100){}. These C style for loops are very error prone critters, due to the "off by one" errors that can happen.

In this case, there is of course no need to check for $i==100 within the loop. That only happens on the last loop iteration. So this is the same thing:

my $i; for ($i = 0; $i <=100; $i++) { statements ... } $i = 200 if defined ($v); #same thing as your code #$i is 101 here, but it was #100 on last loop iteration #test can be moved outside of the loop
However there is a big problem with this optional definition of a variable, $v. I don't see how that works? Please show your proposed code for that. I think that you should define $v and then check if 0/1 false or non zero? I am not sure from the requirements exactly what you intend.