On 8/8/07, sivasakthi <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I have a very large file. It may be contain 1lac lines.. also it > length is increased in dynamically.. > Each time ( per 5 min) i need to read the contents from file & do some > work .. Suppose i have read the lines for first 5 min then after some > time it reads the same line also , so it take more time & it is a > waste of time.. > > The code is following, > > open FF, "/tmp |" || die "can't access log file\n"; > while (<FF>) > { > chomp; > // do some work.. > } > close(FF) > > > Could u help me to solve the pbm?? snip
Use the tell function on FF before closing to get the current offset in the file and then use the seek function on FF to seek that position the next time you open it. Or use File::Tail. perldoc -f tell perldoc -f seek http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/