Link to home
Start Free TrialLog in
Avatar of saibsk
saibsk

asked on

perl tail log

while(1) {
my ($nfound,$timeleft,@pending)= File::Tail::select(undef,undef,undef,'60',$log);
unless ($nfound) {
  print nothing;
}

else {
  my $line = $log->read;
  print $line;
}

But I want to do someting like

tail the file
if nothing in the file then sleep for 1 min and then print nothing
if something in the file just print the message without sleeping please advise
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of saibsk
saibsk

ASKER

after sleep i need to tail the log file again to check if it has anything only then print nothing
how does that differ from the original code?