perl tail log

Posted on 2009-12-22
Last Modified: 2012-05-08
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
Question by:saibsk
    LVL 84

    Accepted Solution

    if( -z $log ){
      sleep 60;
       print $log->read;

    Author Comment

    after sleep i need to tail the log file again to check if it has anything only then print nothing
    LVL 84

    Expert Comment

    how does that differ from the original code?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now