Add $|=1 before the loop, and then learn about $| and output buffering.
% perldoc -q unbuffer [download]
the lowliest monk
In reply to Re: problem with sleep! by tlm in thread problem with sleep! by NodeReaper