Thank you all for replying.
I try it and still does not work. when perl execute line my $pid = open CMD, 'program.exe |' or die $!;. program.exe will run forever and my perl script hang. It will not get to the next line, so it can't capture the output. Also it will not get to the line kill 9, $pid.
I try using fork too, but the same thing happen.
Any other suggestion?.