develooper Front page | perl.beginners | Postings from April 2002

Better "tail -f"

Thread Next
From:
Bruno Figueira
Date:
April 2, 2002 04:30
Subject:
Better "tail -f"
Message ID:
31E38B53D182D51195FA00508BE3A334A470D2@zwnbc004.cala.nortel.com
Hi there,

I have got the example of trailing a file from "Perl Cookbook":

-----------
for (;;) {
   while (<FH>) { print $_ }
   sleep 1;
   seek(FH, 0, 1);
}
-----------

However, if another program removes (all) lines from the file referenced by
FH, perl looses the trailing (for a undetermined time). How do I improve
this code to understand the file was changed?


Cheers,

Bruno


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About