in reply to system() and malformed headers

My guess would be, assuming that "echo hello" is indeed printing to standard output and prints nothing to stderr, that the output in Perl is being buffered by library IO code that the OS doesn't see. OHOH, that would be a common thing and system() would be programmed to flush first...hmm.

Anyway, what is OUTPUT_HANDLE in your last code block? Just do $|=1; by itself at the top of the script, to apply this to STDOUT.