I want a Perl script to check a certain PID every couple of minutes and then kill the process. How do I wait those couple of minutes? Thanks.
Perl | sleep() Function sleep() function in Perl is an inbuilt function which is used to delay the execution of the current script for a specified number of seconds or forever if parameter is not specified. The sleep( ) function accepts seconds as a parameter and returns the same on success.
The times function in Perl returns a list of the current accumulated time for this process in your code and the code of any modules you are using, this process in system calls, all of this process's children in user code, and all of this process's children in system calls.
To access your script's command-line arguments, you just need to read from @ARGV array. Perl allows using @ARGV array as filenames by using <>. The $ARGV contains the name of the current file when reading from <>.
sleep (n);
where n is the number of seconds you want to sleep.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With