Johnson, Reginald (GTI) wrote:
I don't see what I am doing wrong here. I am trying to print to the
filehandle LINOUT but nothing is being printed to the file.
Ultimately I want to monitor the input file and when it is written to I
want to take the update and put into another file for processing.
#!/usr/bin/perl
use strict;
use warnings;
open(INFILE, "tail -f /tmp/lin_tape.errorlog |") or die "can't
open file: $!";
open (LINOUT, ">", "/tmp/linout") or die "lin tape out file
could not be opened :$!";
my $line;
while ( $line = <INFILE> )
{
print "$line\n";
print LINOUT "$line";
print LINOUT "hey\n";
}
close(INFILE);
close(LINOUT);
There may be several reasons why you're not seeing output, at least not yet.
The tail command will only send lines as they happen; if they only appear
infrequently, output is delayed.
The print LINOUT ... only prints when its buffer is full. On modern computers,
that's something like 16KB. In other words, if the lines are short, it's going
to be a while until you see any output.
--
Just my 0.00000002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/