in reply to delayed print statement?

I suspect your problem is that perl buffers output, i.e. the output aint printed immediatly but later for some efficiency reason. Output to STDOUT typically is line buffered, that means it should be written when you send a newline (\n)...
setting the $OUTPUT_AUTOFLUSH variable ($|) to some value other than 0 will help.

for further help on that topic try to read:
  • perldoc -q buffer
  • man perlvar and look for $|

    hope to help
    snowcrash //////