my $pid = open my $cmdfh, "-|", '/path/to/program' or die "Cannot fork: $!\n"; for ( 1 .. 10 ) { print "."; sleep 1; } kill 9, $pid;