After you've read a line, the file pointer will naturally always be at the end of the line (= beginning of the next line). That is so because for every byte being read, the file pointer advances by one.
Try this to get the correct positions:
my @indx; my $pos = 0; while(<FH1>){ my ($id, $seq) = split /\t/; push(@indx, "$id\t$pos"); $pos = tell FH1; }
In reply to Re^5: seeking help for seek function
by almut
in thread seeking help for seek function
by pearly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |