Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The problem: the value of i increments fine in the outer block, but the inner block simply receives the initial value of i (0 or otherwise), and never increments. It seems a no-brainer scoping issue, but I expected the for-loop increment to be passed to the inner block. Obviously, that's not happening. What am I missing here?for (my $i = 0; $i <= 4; $i++) { while (my $line = readline(SORTD)) { my $number = substr($line, $i*2, 2); } }
|
|---|