Perl kill Function
This function sends a signal to a list of processes. Returns the number of processes successfully signaled.
If SIGNAL is zero, no signal is sent to the process. This is a useful way to check that a child process is alive and hasn't changed its UID. The precise list of signals supported is entirely dependent on the system implementation:
Name Effect SIGABRT Aborts the process SIGARLM Alarm signal SIGFPE Arithmetic exception SIGHUP Hang up. SIGILL Illegal instruction SIGINT Interrupt SIGKILL Termination signal SIGPIPE Write to a pipe with no readers. SIGQUIT Quit signal. SIGSEGV Segmentation fault SIGTERM Termination signal SIGUSER1 Application-defined signal 1 SIGUSER2 Application-defined signal 2
Following is the simple syntax for this function:
kill EXPR, LIST
This function returns the number of processes successfully signaled.
Following is the example code showing its basic usage:
#!/usr/bin/perl $cnt = kill 0, getppid(), getpgrp(), 2000; print "Signal sent to $cnt process\n";
When above code is executed, it produced following result