in reply to Handling third party exe messages through perl script?

Use a bidirectional open to pipe in the output and when the prompt is encountered, merely print:

use IPC::Open2; my $pid = open2(*OUTPUT, *INPUT, "program.exe"); while (my $line = <OUTPUT>) { print INPUT 'f' if /Abort\/Retry\/Ignore/; }

Be sure to read more about bidirectional IPC, in perlfunc under open and perlipc. The above is merely an example -- the referenced perldoc describe the IPC is considerable detail and are recommended reading.

Replies are listed 'Best First'.
Re^2: Handling third party exe messages through perl script?
by rev_1318 (Chaplain) on May 12, 2005 at 07:39 UTC
    Note however, that some programs need a tty for interaction and them the open2 may fail. In that case, Expect may come to the rescue.

    Paul