Tutorials Point


  Perl Home

  PERL Functions

© 2013 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL sleep Function



Advertisements

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.

#!/usr/bin/perl

$num = 5;
while($num--){
    sleep(1);
}


Advertisements


  

Advertisements