Pausing a script

D

\Dandy\ Randy

Hello, could use some help finding a way to pause my script for a
predetermined interval during a loop. I have a script that gets some data
for a text file and gathers it into an @array. See below.

open (ADDRESSES, "<data/addresses.txt") or die "Can't open file: $!";
@list=<ADDRESSES>;
close(ADDRESSES);

foreach $list(@list) {
perform function #1
perform function #2
pause 3 seconds
}

I would like a 3 second pause during the above foreach loop. How might I
accomplish this? Thanx!

Randy
 
K

ko

Dandy" Randy said:
Hello, could use some help finding a way to pause my script for a
predetermined interval during a loop. I have a script that gets some data
for a text file and gathers it into an @array. See below.

open (ADDRESSES, "<data/addresses.txt") or die "Can't open file: $!";
@list=<ADDRESSES>;
close(ADDRESSES);

foreach $list(@list) {
perform function #1
perform function #2
pause 3 seconds
}

I would like a 3 second pause during the above foreach loop. How might I
accomplish this? Thanx!

Randy

Replace 'pause 3 seconds' with 'sleep 3' in your script.

'perldoc -f sleep' gives you all the details


HTH - keith
 
M

Michael Budash

\"Dandy\" Randy said:
Hello, could use some help finding a way to pause my script for a
predetermined interval during a loop. I have a script that gets some data
for a text file and gathers it into an @array. See below.

open (ADDRESSES, "<data/addresses.txt") or die "Can't open file: $!";
@list=<ADDRESSES>;
close(ADDRESSES);

foreach $list(@list) {
perform function #1
perform function #2
pause 3 seconds
}

I would like a 3 second pause during the above foreach loop. How might I
accomplish this? Thanx!

Randy

perldoc -f sleep
 
D

\Dandy\ Randy

Jay Tilton said:
: I would like a 3 second pause
sleep(3);

Can this code be configured to only pause for half a second? like this
sleep(0.5); or something sililair?

Randy
 
M

Michael Budash

\"Dandy\" Randy said:
Can this code be configured to only pause for half a second? like this
sleep(0.5); or something sililair?

Randy

i say again:

perldoc -f sleep

RTFM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,351
Latest member
LolaD32479

Latest Threads

Top