in reply to communication between C and perl

I'm not sure what that program is supposed to do, but I think you're getting bitten by this (from my system() manpage):
The context in which the utility is ultimately executed may differ from that in which system() was called. For example, file descriptors that have the FD_CLOEXEC flag set are closed, and the process ID and parent process ID are different. Also, if the executed utility changes its environment variables or its current working directory, that change is not reflected in the caller’s context.