freekngeek has asked for the wisdom of the Perl Monks concerning the following question:
Hello everyone, I am working on a script and I have to run a loop to print some lines and I need to increment some variables by 1 and some by 2. Is it possible to do that in a same loop ?
for(my $i = 0; $i<$size; $i += 2){ print FH "myMetal$i = dbCreatePath(cv list(\"@$metal_ref[$i]\" \" +drawing\") list(x1:y1 x2=(x1-(@$length_ref[$i]-1)):y1 ) @$width_ref[$ +i]) \n"; }
The thing is, that I also need to increment those x and y values by 1, but I am not able to do it. I can't run an extra loop, because it will give me multiple result that I don't need. So I hope if anyone of you could help me with this. Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Increment by 2 and by 1 in same loop.
by hdb (Monsignor) on Apr 16, 2013 at 09:50 UTC | |
by AnomalousMonk (Archbishop) on Apr 16, 2013 at 10:21 UTC | |
|
Re: Increment by 2 and by 1 in same loop.
by Anonymous Monk on Apr 16, 2013 at 09:53 UTC | |
by locked_user sundialsvc4 (Abbot) on Apr 16, 2013 at 11:17 UTC | |
|
Re: Increment by 2 and by 1 in same loop.
by davido (Cardinal) on Apr 16, 2013 at 16:13 UTC |