Next | Program Repair Shop | 143 |
13 my (..., $x, ...);
214 foreach $x(0..2) { 215 if ($squares->[0][$x] eq "?") { 216 print_cell($squares, $page, $x, "0"); 217 }else { 218 print ("<td>" . $squares->[0][$x] . "</td>\n"); 219 } 220 }
$x is used other places in the program, but they are all unrelated
This could cause a bug
The program might set $x in one place
Then use it accidentally in another place
Better:
foreach my $x(0..2) { if ($squares->[0][$x] eq "?") { print_cell($squares, $page, $x, "0"); }else { print ("<td>" . $squares->[0][$x] . "</td>\n"); } }
Next | Copyright © 2002 M. J. Dominus |