This is what is wrong (as explained). The nested c-style loops can produce desired output if you do it like this:my $j = $i * $g;
use strict; use warnings; my $group = 20; for ( my $id = 0; $id < 120; $id += $group ) { for ( my $grp = 1; $grp <= $group; $grp += 1 ) { printf "ID: %d\tGRP: %d\n", $id + $grp, $grp; } }
In reply to Re: Need help with nested for loops
by Anonymous Monk
in thread Need help with nested for loops
by fidda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |