On Fri, 12 Jul 2002 08:24:55 -0400, [EMAIL PROTECTED] (Fliptop)
wrote:

>Max Clark wrote:
>
>> I am trying to write a cgi program to "tail -f" a log file. I have a perl
>> script that will open and print the log file, however it closes as soon as
>> it reads whatever is in the file at that particular time. How do I mimic
>> "tail -f" functionality?
>
>
>try the qx// operator:
>
>my $tail = qx/tail -f filename.ext/;
>print $tail;

#!/usr/bin/perl
$filename='my.log';

open( IN, $filename ) or die "Couldn't open $filename: $!";
my $last;
while ( <IN> ) {
$last = $_;
}
print "Last line is:\n$last\n";






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to