On 10/19/09 Mon  Oct 19, 2009  11:38 AM, "Harry Putnam" <rea...@newsguy.com>
scribbled:


> 
> I'm not sure what it is about the tail -f command that allows it to
> keep reading over restarts of system logger (on Opensolaris)... but
> how can I emulate whatever it is.. in perl?
> 

There is an FAQ:

    perldoc -q tail

See if that helps you.

The idea is to read until the end-of-file is reached, pause for awhile, then
try reading again. However, reaching EOF sets a flag in the file handle and
subsequent reads will fail. The trick is to reset the EOF flag with a seek
command, either

    seek($fh,0,1)

or

    $curpos = tell($fh);
    seek($fh,$curpos,0);




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to