My perl script executes a command on unix box and saves the output to a filehandler. The command it executes prints lines of stats every 10 seconds to standard out.
The command the perl script executes will always run and if the program it is trying to get the stats for isn't available then it just waits until the program is back up again. What I want to do is print the text "No data" if there are no more new lines after 10 seconds?
This is the code so far:open(STATISTICS, "/home/<app>/client/bin/<stats> -c usage_counter 2> +/dev/null |") || die "can't fork: $!"; while (<STATISTICS>) { print $_; } close STATISTICS || die "ERROR : $! $?";
In reply to Check for a new line by h123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |