On Sun, 17 Oct 2004 01:12:45 +0000 (UTC), Mark Stosberg <[EMAIL PROTECTED]> wrote: > It also worked. Here's what I used: > > `echo 'y' | my_shell_cmd` > > I'm sure there's some other cooler way, but this works well enough for me.
Eventually you'll want something more flexible and portable. You can
use IPC::Open2.
use IPC::Open2;
sub cmd {
my($cmd, $input) = @_;
open2 *IN, *OUT, $cmd or die "Can't run $cmd: $!";
print IN $input;
close IN;
my $output = <OUT>;
close OUT;
return $output;
}
