in reply to Running a C program from Perl

Fix what ikegami says. You might also consider handling the redirection yourself. It doesn't make much difference if the shell does it or if perl does it, but from perl, it might just be more readable (or at least more pliable). You could also possibly alter the output on the way through:
use strict; # consider this also use warnings; # consider this also open my $input, "-|", "./hello.exe" or die "woops: $!"; open my $output, ">", "output.txt" or die "darn: $!"; while(my $line = <$input>) { # optionally do things here print $output $line }

(autodie seems to be more fashionable than my or dies too.)

In any case, doing the above would have complained more perlishly (perhaps) than the shell. It'd be more reliable if you could use the list version of the open popen. If it won't hurt anything it might even help to call it like this: open my $input, "-|", qw(./hello.exe 1) or die "popen fail: $!". If you can use the list version of open, you definitely get a perl error since the shell isn't even involved!

-Paul