Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a requirement where i need to increment the FOR loop again even if the condition is already met
for ($i = 0; $i <=100; $i++) { statements ... if (defined $v) && ($i == 100) { $i = 2* $i } }
In the above code, i have defined a value $v and some statements related to $v to be executed only when $i reaches 100. I need to set $i as 200, if $v is defined. My code reaches the condition, however it is not incrementing . Is there a way to make it work
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Incrementing the loop again.
by Corion (Patriarch) on Mar 12, 2016 at 15:33 UTC | |
|
Re: Incrementing the loop again.
by GrandFather (Saint) on Mar 12, 2016 at 22:03 UTC | |
|
Re: Incrementing the loop again.
by 1nickt (Canon) on Mar 12, 2016 at 15:41 UTC | |
by Anonymous Monk on Mar 13, 2016 at 02:47 UTC | |
|
Re: Incrementing the loop again.
by Laurent_R (Canon) on Mar 12, 2016 at 20:10 UTC | |
|
Re: Incrementing the loop again.
by Marshall (Canon) on Mar 13, 2016 at 06:24 UTC |