Next | Program Repair Shop | 254 |
Here we're making two passes over @chain:
for (@chain) { if ($ct_scanout ) { $_->[$i] =~ s/0/L/g; $_->[$i] =~ s/1/H/g; } elsif ($ct_scanout==0) { $_->[$i] =~ s/X/0/g; } } my @chars = map $_->[$i], @chain;
"Do I really need two passes?"
"Or could I do both transformations in one pass?"
Yes:
my @chars; for (@chain) { if ($ct_scanout ) { $_->[$i] =~ s/0/L/g; $_->[$i] =~ s/1/H/g; } elsif ($ct_scanout == 0) { $_->[$i] =~ s/X/0/g; } push @chars, $_->[$i]; }
Next | Copyright © 2002 M. J. Dominus |