Next | Program Repair Shop | 256 |
33 for ($i=0;$i<@{$chain[3]};$i++){
This is the sort of thing that drives maintenance programmers bats
3? Why 3???
My guess: The choice was arbitrary because all the chains have the same length
If that's true, we might check the condition and report an error if not:
my $BAD_LENGTH; for my $n (1 .. $#chains) { unless (@{$chains[$n]} == @{$chains[1]}) { warn "Chain 1 and chain $n have different lengths!\n"; $BAD_LENGTH = 1; } } exit 1 if $BAD_LENGTH;
The maintenance programmer would no longer have to wonder why one chain was special
Alternative:
for ($i=0;$i<@{$chain[1]};$i++){
If you must choose arbitrarily, choose the first item
Next | Copyright © 2002 M. J. Dominus |