To rewind a file to beginning use seek FILE,0,0. Read the seek for more info on how this works.
Update:Also spotted why you're losing data.. the while (<DATA2>) reads in one line itself into $_, and then you read in a second into $line with $line= <DATA2>, with the result that half the lines are entirely ignored. A better way would be while (my $line= <DATA2>) instead of either of both of the other lines.
In reply to Re: rewinding filehandle/line skipping ?
by Molt
in thread rewinding filehandle/line skipping ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |