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.
In reply to Re: How to kill an external program
by BronzeWing
in thread How to kill an external program
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |