in reply to Incrementing the loop again.

Are you sure about the value of $v? Have you printed it out and examined it?

I can't see the point in incrementing a counter variable after the end of the loop, but a more natural way to write your loop in Perl would be:

my $i = 0; for ( 1 .. 100 ) { $i++; # statements $i = 200 if $i == 100 and defined $v; }

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Incrementing the loop again.
by Anonymous Monk on Mar 13, 2016 at 02:47 UTC

    Thanks for your replies folks. In the above code, once $i is incremented to 101, it won't hit the condition

    if $i == 100 and defined $v;

    I wanted to execute the statements after the above pasted code, once $i becomes 101 to 200