Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wait for a certain period of time in Perl on Linux

Tags:

linux

perl

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.

like image 307
Chaggster Avatar asked Jul 06 '10 13:07

Chaggster


People also ask

How do I add a delay in Perl?

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.

How do I measure time in Perl?

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.

How do I read a command line argument in Perl?

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 <>.


1 Answers

sleep (n); where n is the number of seconds you want to sleep.

like image 73
MJB Avatar answered Oct 14 '22 08:10

MJB