Colleagues I'm doing a perl script so that as data is inserted into a log file, I instantly get it and process it but it is giving me an error (the error is in the open) and I do not know what to do. I pass the code:
#######!/usr/bin/perl
use strict;
use warnings;
use Shell;
my $logfile = "...";
my $run;
open $run, ("tail -f $logfile") or die " El fichero $logfile no tiene datos" and exit;
while (<$run>) {
...
}
close ($run);
ERROR:
The file ... has no data at ... line 9.
Note. The log if it contains data and if it reads it to me but it does not continue executing waiting for new data:
open $run, $logfile or die " El fichero $logfile no tiene datos" and exit;