Next | Program Repair Shop | 270 |
It's easy to make the globals into parameters:
sub printout { my ($scanout, @chain) = @_; for my $i (0 .. $#{$chain[1]}){ my $chars = ""; for (@chain) { next unless defined; $chars .= $_->[$i]; } if ($scanout) { $chars =~ tr/01/LH/; } else { $chars =~ tr/X/0/; } print OUTFILE $scanout ? "\n(ct_so\n" : "\n(ct_si $ct_si{tdi}\n", "$chars\n )"; } }
In the main loop, the call becomes:
printout($ct_scanout, @chain) if $1 == 7;
Next | Copyright © 2002 M. J. Dominus |