open COMMAND,'-|','some_command'; $input=; #... bla bla $pid=fork #....bla bla wait if $pid #... bla bla