hide random home http://www.fmi.uni-passau.de/archive/doc/unix/perl/faq/2.41.html (Einblicke ins Internet, 10/1995)

How do I do a "tail -f" in Perl?

How do I do a "tail -f" in Perl?


    Larry says that the solution is to put a call to seek in yourself. 
    First try

            seek(GWFILE, 0, 1);

    If that doesn't work (depends on your stdio implementation), then
    you need something more like this:


        for(;;) {
                for ($curpos = tell(GWFILE); $_ = <GWFILE>; $curpos = tell(GWFILE)) {
                       # search for some stuff and put it into files
                }
                # sleep for a while 
                seek(GWFILE, $curpos, 0);
        }