in reply to communicating with another program

It's a deadlock situation. test1 prints a line, then waits for input from test2. At the same moment, test2 reads the line from test1, and then waits for more, until it receives end of file. But you don't close the output handle in test1 until you've seen end-of-file from test2. Both programs are waiting for input from the other, and they'll wait till they see end-of-file. Which is never going to happen.

Close your output handle in test1 before reading input from test2 and it should work (although I didn't test it, there may be more bugs lurking).

And it can't hurt to check the return value of open2.

Perl --((8:>*

Replies are listed 'Best First'.
Re^2: communicating with another program
by twotone (Beadle) on Dec 01, 2005 at 04:30 UTC
    Thanks, I should check the return value of open2. The thing I'm confused about with open2 is that according to the Perl Cookbook, it is supposed to let me both read from and write to a program. Hmmm, back to the drawing board... Gotta work on it a bit more to figure this out.