It is almost essential to use a bidirectional pipe (as already described by
ioannis) when a current step in the processing has to be done outside perl before continuing - what IS too slow would be to close and reopen the pipe more than once in cases where one can pipe a complete dataset in (using print) and read the processed results back out processing them exhaustively in perl before closing the read pipe.