Next | Program Repair Shop | 250 |
One option is always to offset the index numbers:
next unless /\t*chain\s+"chain([0-9])"/; $chain[$1 - 1] = cleanup($_);
Or we might ignore element 0 in various ways:
for (@chain[1..$#chain]) { $_->[$i] =~ s/0/L/g; $_->[$i] =~ s/1/H/g; }
Or:
shift @chain; for (@chain) { $_->[$i] =~ s/0/L/g; $_->[$i] =~ s/1/H/g; }
Or:
for (@chain) { next unless defined; $_->[$i] =~ s/0/L/g; $_->[$i] =~ s/1/H/g; }
Which is best?
Next | Copyright © 2002 M. J. Dominus |