use IPC::Open2; use File::Temp; my ($fh, $path) = tempfile(); unlink($path); # automatically releases storage on exit my $pid = open2($fh, \*STDIN, ’some', 'cmd', 'and', 'args'); waitpid $pid, 0; # wait for child to exit # now you can read the child's output from $fh