Maybe this example might help a bit (from the Perl Cookbook):
use IPC::Open2;
open2(*README, *WRITEME, $program);
print WRITEME "here's your input!\n";
$output = <README>;
close(README);
close(WRITEME);
You can either use typeglobs as used above, or you can use self-made
IO::Handle objects and pass them in, as the
open2 function will not create handles for you.
Note that you do not need to use die with the
open2 function, as it dies on error. If you need to know if it produced an error, wrap it in an
eval block and test
$@.
I think
IPC::Open3 module's args are different, and check out the
IPC::Open2 and
IPC::Open3 documentation for more detailed information.