I think you want IPC::Open2, which will let you open a pipe for both reading and writing. Then you can write your data into it and read the results directly. Make sure the script you're interacting with can support this, though; in particular, it shouldn't buffer its output.