That's perl's buffering. Just like the C stdio library, it buffers its output; when it's printing to the terminal it flushes the buffers every time it prints a newline character, and printing to a pipe or a file only when it finishes writes a full block of bytes. It does one final flush right before the program exits.
The easiest way to fix this is to turn on autoflush, with this assignment: $|=1;
In reply to Re: Won't print unless newline is included?
by sgifford
in thread Won't print unless newline is included?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |