this could be because of
buffering. (perl actually does not send one line at a time; it waits for more FIRST unless you tell it differently).
There is a very excellent and easy to understand explanation at:
http://perl.plover.com/FAQs/Buffering.html
Probably what you want is:
use IO::Handle;
STDOUT->autoflush;
But do read the FAQ and all will become clear.