in reply to Pipe problems

Make sure B has autoflush turned on before the print for STDOUT...
$| = 1; print ...

Also, terminate the print with a '\n'. Though you haven't shown it, I'm assuming A reads back the line printed from B. (If not, B can hang on the print waiting for A to read it if B prints a large enough string, filling the pipe.) Update: From your code, it looks like A sends the '\n' to B so the comment about terminting the print may not apply.

Replies are listed 'Best First'.
Re^2: Pipe problems
by sgifford (Prior) on Aug 31, 2004 at 19:36 UTC
    Autoflush on the WRITE filehandle in A seems more likely to be the problem. In newer versions of Perl you can use:
    use IO::Handle; # ... WRITE->autoflush(1);
    In older versions you should use:
    $oldfh = select(WRITE); $| = 1; select($oldfh);

    Update: bluto's right, IPC::Open2 does this for you. I usually just use pipe, which doesn't.

      This won't help this problem. According to even older perl docs for IPC::Open2 autoflush is turned on for the parent's write handle.