in reply to Controlling input and output of different program

I was able to throw this together after taking a gander at the link provided by Anonymous Monk in this thread:

use strict; use warnings; use FileHandle; use IPC::Open2; my $pid = open2(*Reader, *Writer, "perl dialog.pl"); print Writer "42\n"; chomp( my $got = <Reader> ); print $got, $/;

Notice the explicit use of chomp() as well as terminating the sent string with a newline. I recommend you alter your dialog.pl script to chomp() user input:

chomp( my $age = <> );

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Controlling input and output of different program
by rkrasowski (Sexton) on Mar 31, 2015 at 02:16 UTC
    Great, thanks a lot, I implemented your advice and it is working, link that you provided is fantastic. Thanks again Robert