in reply to sleep problem !
Your standard output needs to be unbuffered.
Add this line before your loop:
$|++;
And you should get what you want.
See Suffering from buffering (off site) for a thorough explanation.
|
---|
In Section
Seekers of Perl Wisdom