Jan 4, 2011

PERL sleep Function

PERL sleep Function:

Syntax:

sleep EXPR
sleep

Definition and Usage:

Pauses the script for EXPR seconds, or forever if EXPR is not specified. Returns the number of seconds actually slept. Can be interrupted by a signal handler, but you should avoid using sleep with alarm, since many systems use alarm for the sleep implementation.

Return Value:

  • Integer, number of seconds actually slept

Example:

Try out following example: You will understand the functionality of sleep.
$num = 5;
while($num--)
{
    print sleep(1);
print "\n";
}

No comments:

Post a Comment