That would be because when you run your executable connected to terminal (STDOUT) it doesn't buffer...well it's actually line buffered. but when you run it and connect it to a pipe, then it's buffering differently (probably 1024 bytes or such but don't know for sure.) If you force flush as outlined, the problem will disappear. The problem is introduced by the OS handling of pipes..not the C program (executable) neither perl is at fault.