open my $fh, '|command' or die "Can't run command: $!"; print $fh "input for command\n"; print $fh "more input for command\n"; close $fh;