in reply to How to print to STDIN of a cmd and read it's STDOUT

See IPC::Open2.
#!/usr/bin/perl use strict; use warnings; use IPC::Open2; my $pid = open2(my $OUT, my $IN, "/bin/sed", "s/h/H/"); print $IN "hallo\n"; close $IN; print <$OUT>;

Output:

Hallo
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: How to print to STDIN of a cmd and read it's STDOUT
by mhearse (Chaplain) on May 14, 2013 at 23:52 UTC
    Thanks. I also need to block on reading the output after each command is issued. How can I do that? Hmmm... maybe I should just read IPC::Open2 man pages.