Perl Programming/Keywords/sleep
< Perl Programming | Keywords
The sleep keyword
[edit | edit source]sleep makes the process sleep for the number of seconds passed by the EXPRESSION seconds (integer).
It's not a good idea to mix alarm and sleep calls, as sleep is often implemented using alarm.
Syntax
[edit | edit source] sleep EXPRESSION
Examples
[edit | edit source]![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Crystal_Clear_action_apply.png/20px-Crystal_Clear_action_apply.png)
print "Hello " . time . "\n";
sleep 5;
print "World! " . time . "\n";
returns the two strings with a leap of about 5 s:
Hello 1424262965 World! 1424262970