my $pid = open CMD, 'program.exe |' or die $!; my @output; push @output, scalar for 1 .. 100; kill 9, $pid; ## Do something with @output