http://www.perlmonks.org?node_id=1045394


in reply to open3 but for n file descriptors

Are you sure you really need to have the PID of child processes when using IPC::Run? It allows you to send signals and kill children directly. If you really must have the PID, it's possible to use start/pump/finish instead of run:

use strict; use warnings; use IPC::Run qw( start ); # Initiate the child process my $data; my $s = start [ 'ls' ], '>', \$data; # Show its PID for my $kid ( @{$s->{KIDS}} ) { print $kid->{PID}; } # pump data in and out, then clean up $s->pump; $s->finish;