Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Delaying a loop for a specified time

by Anonymous Monk
on Aug 21, 2001 at 14:53 UTC ( #106508=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to insert a delay value into a loop, so that it will wait for a set amount of time, before running the loop again?

Thanks.

Replies are listed 'Best First'.
Re: Delaying a loop for a specified time
by busunsl (Vicar) on Aug 21, 2001 at 14:59 UTC
Re: Delaying a loop for a specified time
by ChOas (Curate) on Aug 21, 2001 at 15:00 UTC
    sleep(number of seconds to sleep);

    or

    select(undef,undef,undef,(number of seconds to sleep));

    When using select you can use millisecond timing like
    filling in 0.5 for a 500 millisecond sleep...

    GreetZ!,
      ChOas

    print "profeth still\n" if /bird|devil/;
Re: Delaying a loop for a specified time
by tune (Curate) on Aug 21, 2001 at 15:22 UTC
    Also try Time::HiRes for split second sleep and for much more features.

    --
    tune

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://106508]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2019-05-27 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (155 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!