stupid perl question

Steven A. DuChene linux-clusters at mindspring.com
Thu Jun 23 16:03:13 MST 2011


I am attempting to do a "tail -f" on a log file that has a new line added to it every 15 seconds.
I need to parse and process each new line as it is added to the file.

I am trying to use the following example code from cpan to see if the basic concept will
work using File::Tail but when I run the example code below and add lines to the file
I get nothing out.

#!/usr/bin/perl

use File::Tail;
$file = File::Tail->new("/home/sad/bin/power_input_stuff.txt");
while (defined(my $line = $file->read))
{
    print $line;
}


I am doing the following in another xterm window to add lines to the file:

echo "2011:06:21:15:07:46 57 01 00 a0 04 a0 00 c3 00 a7 00 33 16 01 4e 01 00 00 00 50" >> power_input_stuff.txt

but I am getting NOTHING back in the original window where the perl script is running.

The above perl code is a near direct copy of the File::Tail example code on cpan so I would expect it to work.

What am I doing wrong???
--
Steven DuChene





More information about the PLUG-discuss mailing list