#!/usr/bin/perl use warnings; use strict; use IPC::Open3; my ($age, $height, $weight) = (50,72,250); #yeah I'm fat :-) #my $pid = open3(\*WRITE, \*READ, \*ERROR, 'somecmd.exe'); my $pid = open3(\*WRITE, \*READ,0,'somecmd.exe'); #if \*ERROR is false, STDERR is sent to STDOUT #send query to cmd print WRITE "$age\n"; #give cmd time to output select(undef,undef,undef,.5); print WRITE "$height\n"; select(undef,undef,undef,.5); print WRITE "$weight\n"; select(undef,undef,undef,.5); #get the answer from cmd if needed chomp(my $answer = ); print "$answer\n"; waitpid($pid, 1);