Try adding a new line after the jump ~
use strict;
use warnings;
&main();
sub main()
{
print "hello\n";
while(1)
{
print "go~\n";
sleep(2);
}
}
Explanation of why this works: The stdout stream is buffered, so it will only display what is in the buffer after it reaches a new line (or when it was said). You did not use a new line so that the text is added to the buffer to the size of the buffer.
If you do not want to use a new line, than add the following lines at the beginning
use IO::Handle;
STDOUT->autoflush(1);
source
share