You are not that far off me-thinks. You need to open the RESULT filehandle before you can read from it (or write to it.) And is not clear where you do that. Also, your open line, open (PIPE,"| $path/$command >&RESULT"); doesn't redirect the output of the command to the result file handle. You will need to try a slightly different approach to get bidirectional pipes.