open (P1, "|cmd"); print P1 'input1'; # process output print P1 'input2'; # process output print P1 'input3'; close P1; # process final output