in reply to Re^3: seeking help for seek function
in thread seeking help for seek function

i just noticed that. i want to use file pointer at the begining of everyline.but, when i use tell function, why does it point to the end of the line and not the begining?

Replies are listed 'Best First'.
Re^5: seeking help for seek function
by almut (Canon) on Mar 25, 2010 at 09:15 UTC

    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; }