in reply to Merging two pipes

Try opening pipes from both scripts at the start of your program, then make INPUT a duplicate of these filehandles, e.g.
open SCRIPT, "some_script |"; open OTHERSCRIPT, "some_other_script |"; open INPUT, ">&SCRIPT"; while (<INPUT>) { if ($some_condition) { close (INPUT); open INPUT,">&OTHERSCRIPT"; } do_something_with_input(); if ($some_other_condition) { close (INPUT); open INPUT,">&SCRIPT"; } }
Again the die statements have been left out - I'm sure you will want to put them in for production code.

I've not tested the above code, but looking at the open documentation this should be what you need.

Cheers,

JJ

Update: I've just read jeroenes reply, and I think that I may have misunderstood your question. Do you need both your inputs on the same filehandle?