in reply to 'Tailing' a File?

You want something like the following:
while (1) { while (<FILE>) { # do something here } sleep $for_a_while; seek( FILE, 0, 1 ); }
The seek above convinces Perl that you're no longer at the EOF, thus allowing you to continuously read from your file as new lines are added.

However, the real problem is: what's wrong with using a module? If it's reliable and tested, so what?

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: 'Tailing' a File?
by epoptai (Curate) on Jan 12, 2001 at 03:14 UTC
    I used to have to include the unsavory non-standard module disclaimer before i got perl and apache working at home. The sad fact is that many ISPs with Perl/CGI access don't respond favorably to user CPAN requests, and installing modules in non-standard locations can be tricky, especially if there are further non-standard dependencies.

    Take it from someone who tried to install libwww and all dependencies in a user dir :-o