Programming Perl

Programming PerlSearch this book
Previous: 3.2.149 sinChapter 3
Functions
Next: 3.2.151 socket
 

3.2.150 sleep

sleep EXPR
sleep

This function causes the script to sleep for EXPR seconds, or forever if no EXPR. It may be interrupted by sending the process a SIGALRM. The function returns the number of seconds actually slept. On some systems, the function sleeps till the "top of the second," so, for instance, a sleep 1 may sleep anywhere from 0 to 1 second, depending on when in the current second you started sleeping. A sleep 2 may sleep anywhere from 1 to 2 seconds. And so on. If available, the select (ready file descriptors) call can give you better resolution. You may also be able to use syscall to call the getitimer(2) and setitimer(2) routines that some UNIX systems support.


Previous: 3.2.149 sinProgramming PerlNext: 3.2.151 socket
3.2.149 sinBook Index3.2.151 socket