Next | Program Repair Shop | 147 |
The next block in the program is similar:
98 $rounds = { 99 round1 => { 100 player => '?', 101 computer => '?' 102 }, 103 round2 => { 104 player => '?', 105 computer => '?' 106 }, ...
Maybe we should do the same thing as before?
for my $rn (1..5) { $rounds->{"round$rn"} = { player => '?', computer => '?', } }
That's good (16 lines become 4) but we can do better
The ?'s are never used anywhere, so just leave $rounds undefined!
Delete lines 97-119 entirely; 16 lines become zero
The program is now 10% shorter
This is conciseness at its best!
Next | Copyright © 2002 M. J. Dominus |