in reply to Death of sleep?

STDOUT is buffered, this means that no actual output will be written until the buffer is full or there's a newline. If you print "test\n"; or if you set the $| variable to nonzero (e.g. with $|++; or with $| = 1;), you'll get what you want. Setting $| to a nonzero value disables buffering. Technically, it flushes it every time you write (to STDOUT, in your case).

May I also suggest you to rework your simple loop? I know it's just a test, but it looks a bit weird: there's no need for redo and labels in this simple case, so I'd suggest you to use the variations you mentioned in your post.

Happy learning!

-- TMTOWTDI