in reply to Re^2: Weirdness with IO::Select and IPC::Open3
in thread Weirdness with IO::Select and IPC::Open3

If you don't care about the child's STDERR, you can send it to the parent's STDERR (using '>STDERR' for open3's third arg). Then, all you need is

... while (<$stdout_fh>) { chomp; if (/Have a nice day!\z/) { print("$query\n"); } elsif ($answers{$query}) { print($stdin_fh "$answers{$query}\n"); } else { # ...[ Do something with unrecognised output from STDIN. ]... } }

You can do this because you have a strict request-response protocol.

If you had a more asynchronous protocol, you still have lots of simpler options than select. These include IPC::Run, Expect and threads.

when I google the errors I get when I don't use it, everyone says to use it :-).

What errors would that be?