in reply to I got it working now.
in thread Running a C Program within Perl.
For the record, I think a lot of difficulty figuring out this problem stemmed from the fact that you kept referring to the target as a "C program" when it was in fact a shell script.