| Next |   Program
    Repair Shop ![]()  | 
    267 | 
      sub printout {
        for my $i (0 .. $#{$chain[1]}){
          my $chars = "";
          for (@chain) { 
            $chars .= $_->[$i];
          }
          if ($ct_scanout) {
            $chars =~ tr/01/LH/; 
          } else {
            $chars =~ tr/X/0/;
          }
          print OUTFILE 
            $ct_scanout ? "\n(ct_so\n" : "\n(ct_si  $ct_si{tdi}\n",
            "$chars\n )";
        }
      }
No code is saved
But the test and the tr are done only once instead of 500 times
This reduces the program's run time by about 25%
| Next | ![]()  | 
    Copyright © 2002 M. J. Dominus |