my $output = `command <## open(COMMAND, '| command') or die("Can't run command: $!\n"); # give program 'yes' as input print COMMAND 'yes';