I've originally wrote this code w/ a select/can_read but it ended up hogging the CPU so I put in the 1 second sleep.use IO::File; use strict; my $tail = new IO::File; $tail->open("<./log.dat"); while(1){ my @lines=$tail->getlines(); if(0==scalar(@lines)){ # wait 1 second before trying again... # to keep from hogging CPU cycles sleep 1; }else{ my $line; foreach $line(@lines){ chomp $line; print " \"$line\"\n"; } } }
A few problems with this code:
In reply to Re: tee -f?
by lhoward
in thread tee -f?
by Jonathan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |