Perl | sleep() Function Last Updated : 07 May, 2019 Comments Improve Suggest changes Like Article Like Report sleep() function in Perl is an inbuilt function which is used to delay the execution of the current script for a specified number of seconds or forever if parameter is not specified. The sleep( ) function accepts seconds as a parameter and returns the same on success. Syntax: sleep(seconds) Returns: seconds passed to it as parameter, on success Example 1: perl #!/usr/bin/perl -w # Using localtime() function # to print the time print scalar localtime(); # calling the sleep function sleep(5); print "\n"; print scalar localtime(); Output: Thu Mar 28 06:02:21 2019 Thu Mar 28 06:02:26 2019 Example 2: Perl #!/usr/bin/perl -w # Using localtime() function # to print the time print scalar localtime(); # Using rand() to generate random delay sleep(rand(7)); print "\n"; print scalar localtime(); Output: Thu Mar 28 06:02:26 2019 Thu Mar 28 06:02:27 2019 Comment More infoAdvertise with us Next Article Perl | sleep() Function C Code_Mech Follow Improve Article Tags : Perl Perl-function Perl-Inbuilt-Functions Similar Reads Perl | tell() Function tell() function in Perl is used to get the position of the read pointer in a File with the use of its FileHandle. If no FileHandle is passed then it returns the position within the most recent accessed file. Syntax: tell(FileHandle) Parameter: FileHandle: Filehandle of the file to be accessed. Retur 1 min read Perl | srand() Function The srand() function in Perl helps rand() function to generate a constant value each time the program is run. This srand() function uses the same parameter each time the rand() function is called for getting constant random value. Syntax: srand(seed) Parameters: seed : It is an integer value. Return 3 min read Function Signature in Perl A Perl function or subroutine is a group of statements that together perform a specific task. In every programming language user want to reuse the code. So the user puts the section of code in function or subroutine so that there will be no need to write code again and again. In Perl, the terms func 5 min read Perl | Subroutines or Functions A Perl function or subroutine is a group of statements that together perform a specific task. In every programming language user want to reuse the code. So the user puts the section of code in function or subroutine so that there will be no need to write code again and again. In Perl, the terms func 2 min read Perl Stepping Through Programs with a Debugger Controlling program execution in Perl can be done by telling the debugger to execute up to a certain specified point in the program, called a breakpoint. These breakpoints enable the user to divide the program into sections and look for errors. Following are some commands in a debugger that are used 3 min read Like