On 5/9/05, N. Ganesh Babu wrote:
> Dear All,
> 
> In the attached file, the date is present in the last line. My
> requirement is to capture the date and fill it in the date field from
> the line 1. after capturing the date through regular expression I am
> using seek(FH,0,0) to goto the beginning of the file. But it has no effect.
> 

Your code will read the first line forever, since every time it will
read it, the next statement after the "if' which is the seek (that is
missing the ";" at the end BTW) will reset the position to the start
of the file.
1. You should move the seek inside the "if".
2. Even after fix (1), your program will be stuck in an infinite loop,
since every time it will reach the last line it will jump right back
to the first line. Use a flag, condition or other mechanism to make
sure you loop through the file only one.

HTH,
-- 
Offer Kaye

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to