http://qs1969.pair.com?node_id=226570


in reply to How to kill an external program

The following code works for me. It assumes the process returns before it's done (I think all Win32 GUI programs do that, but command line ones don't - which sort are you using?).

my $PID = open my($Notepad), "|notepad.exe"; sleep 1; print "DIE!\n"; kill 9, $PID;

Perl Monks do it more than one way.