Next | Program Repair Shop | 218 |
Glancing over the program, this is the first thing you see
26 SWITCH: { 27 $chain_number==1 && do { 28 @chain1 = split (//,$chain_input); 29 $scan_chain_length1 = @chain1; }; 30 $chain_number==2 && do { 31 @chain2 = split (//,$chain_input); 32 $scan_chain_length2 = @chain2; }; 33 $chain_number==3 && do { ... 45 $chain_number==7 && do { 46 @chain7 = split (//,$chain_input); 47 $scan_chain_length7 = @chain7; 48 &printout; 49 };
As usual, we will replace these with an array of arrays
$chain[$chain_number] = [split //, $chain_input]; $scan_chain_length[$chain_number] = @{$chain[$chain_number]}; &printout if $chain_number == 7;
23 lines become 3
Next | Copyright © 2002 M. J. Dominus |