See IPC::Open3. Should solve the problem nicely — although it may require some thought. There are also really nice POE solutions for this, particularly if you want to do something event based instead of polling the inputs/outputs.
-Paul
Comment on Re: Catching STDIN and STDERR on the fly