Perl - marker ?

K

Kevin

I want to be able to read a text file every 10 minutes or so. Since
the file can get pretty large over time, I want to pick up where I
left off earlier. Is this possible using Perl ?

-Kevin.
 
R

Randal L. Schwartz

Kevin> I want to be able to read a text file every 10 minutes or so. Since
Kevin> the file can get pretty large over time, I want to pick up where I
Kevin> left off earlier. Is this possible using Perl ?

search.cpan.org - enter "File::Tail".
 
P

Peter Makholm

Kevin said:
I want to be able to read a text file every 10 minutes or so. Since
the file can get pretty large over time, I want to pick up where I
left off earlier. Is this possible using Perl ?

The tell() function can tell you the current position in a file and
the function seek will take you to a given position in a file. Then
you just need to store this offset somewhere.

If you have a long running perl process which reads to the end of
file, waits ten minutes and want to read further, you can use seek to
clear the end of file-state without reopening the file or without
using tell. $fh->clearerr() should do the same.

//Makholm
 
J

Jürgen Exner

Kevin said:
I want to be able to read a text file every 10 minutes or so.

perldoc -f sleep
perldoc -q timeout
Since
the file can get pretty large over time, I want to pick up where I
left off earlier. Is this possible using Perl ?

perldoc -f seek

You could also take a look at "perldoc -q tail"

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top