http://qs321.pair.com?node_id=298641


in reply to Killing child process

To quote the perlfunc manpage for kill,
Unlike in the shell, if SIGNAL is negative, it kills process groups instead of processes. (On System V, a negative PROCESS number will also kill process groups, but that's not portable.) That means you usually want to use positive not negative signals.
So all you have to do is call kill with the negative value for the signal you want. E.g. kill -9, $pid;. If you want to use the name of a signal, I think you'll have to do something like:
use POSIX; kill - SIGKILL, $pid;
(If you leave out the space after the minus sign, you'll get a warning message like "Ambiguous use of -SIGKILL resolved as -&SIGKILL()". Of course you could type  kill -&SIGKILL(), $pid, but it seems easier to just leave a space).