http://www.perlmonks.org?node_id=1038911


in reply to Re^2: How to set timer in perl
in thread How to set timer in perl

I'd venture to say that you're hitting EOF and exiting the loop before the five seconds have passed. Perhaps you want File::Tail?