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;