use IPC::Run qw ( start pump finish ) ## Build the harness, open all pipes, and launch the subprocesses my $h = start \@cat, \$in, \$out ; $in = "first input\n" ; ## Now do I/O. start() does no I/O. pump $h while length $in ; ## Wait for all input to go ## Now do some more I/O. $in = "second input\n" ; pump $h until $out =~ /second input/ ; ## Clean up finish $h or die "cat returned $?" ;