kill

killSIGNAL,LIST
This function sends a signal to a list of processes. For
SIGNAL, you may use either an integer or a
quoted signal name (without a “SIG”
on the front). Trying to use an unrecognized
SIGNAL name raises an exception. The function
returns the number of processes successfully signalled. If
SIGNAL is negative, the function kills
process groups instead of processes. (On Unix systems derived from SysV,
a negative process number will also kill process groups, but that’s not
portable.) A PID of zero sends the signal to all processes of the same
group ID as the sender. For example:
$cnt = kill 1, $child1, $child2;
kill 9, @goners;
kill "STOP", getppid # Can *so* suspend my login shell...
unless getppid == 1; # (But don't taunt init(8).)A SIGNAL of 0 tests whether a process is still alive and
that you still have permission to signal it. No signal is sent. This way
you can check whether the process is still alive and hasn’t changed its
UID.
use Errno qw(ESRCH EPERM); if (kill 0 => $minion) { say "$minion is alive!"; } elsif ($! == EPERM) { # changed UID say "$minion has escaped ...