in reply to split sleep question
You need to turn off buffering on STDOUT with $|=1 before the loop.