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)
In reply to Re: Controlling input and output of different program
by jeffa
in thread Controlling input and output of different program
by rkrasowski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |