in reply to Re: substring exists at particular postion?
in thread substring exists at particular postion?


If you are going to match the same position more than once, as indicated by your code, then you should store the value from a single call to substr and use that in the subsequent if statements:
while(<IN>) { my $tmp = substr($_, 259, 1); if($tmp eq "B") { print B $_; } else if ($tmp eq "T") { print T $_; } else if () { # and so on for at least 10 lines!... } }

--
John.