in reply to How to flush output to the console?

Turn on "autoflush":

$|++;
Put this just after your #!/.../perl line.