in reply to Death of sleep?

You are suffering from buffering. Try: $|=1 near the beginning of your program, or pick a file descriptor like STDERR that doesn't have this problem. More information in the FAQ...