Delay for a specified amount of time.
sleep {{seconds}}sleep 20 && {{command}} sleep EXPR
sleep Causes the script to sleep for (integer) EXPR seconds, or
forever if no argument is given. Returns the integer number of
seconds actually slept.
EXPR should be a positive integer. If called with a negative
integer, "sleep" does not sleep but instead emits a warning,
sets $! ("errno"), and returns zero.
"sleep 0" is permitted, but a function call to the underlying
platform implementation still occurs, with any side effects that
may have. "sleep 0" is therefore not exactly identical to not
sleeping at all.
May be interrupted if the process receives a signal such as
"SIGALRM".
eval {
local $SIG{ALRM} = sub { die "Alarm!\n" };
sleep;
};
die $@ unless $@ eq "Alarm!\n";
You probably cannot mix "alarm" and "sleep" calls, because
"sleep" is often implemented using "alarm".
On some older systems, it may sleep up to a full second less
than what you requested, depending on how it counts seconds.
Most modern systems always sleep the full amount. They may
appear to sleep longer than that, however, because your process
might not be scheduled right away in a busy multitasking system.
For delays of finer granularity than one second, the Time::HiRes
module (from CPAN, and starting from Perl 5.8 part of the
standard distribution) provides "usleep". You may also use
Perl's four-argument version of "select" leaving the first three
arguments undefined, or you might be able to use the "syscall"
interface to access setitimer(2) if your system supports it. See
perlfaq8 for details.
See also the POSIX module's "pause" function.
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 21:25 @216.73.216.151 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)