Next | Program Repair Shop | 148 |
Line 74--120 have become:
if ($round > 0) { for my $rn (1..5) { $rounds->{"round$rn"} = { player => $page->param("round${rn}_x"), computer => $page->param("round${rn}_o"), } } }
We can do still better
In round 3, some of these items are full of undefs
In round 1, most of these items are full of undefs
What would happen if we let this execute for round 0 also?
All of the items would be full of undefs
That is what they are full of anyway!
for my $rn (1..5) { $rounds->{"round$rn"} = { player => $page->param("round${rn}_x"), computer => $page->param("round${rn}_o"), } }
Avoid special cases
33 lines have become 4
Next | Copyright © 2002 M. J. Dominus |