trying to implement a timer

F

fnord

I've been teaching myself perl today by writing a simple word game. It's going quite well, except I've hit a wall on the timer.

At the moment it's a simple CLI interface, and what I need to do is present the player with a list of letters, and give them 3 minutes to enter as many words as they can from the list of letters.

I'm thinking that the easiest way to do this would be to wrap the game logic in a while() loop for the 3 minutes.

I can't, however, find any examples of how to do this on the web or in the newsgroups.

Can someone give me a hand?


thanks,
fnord
 
S

Shawn Milochik

I've been teaching myself perl today by writing a simple word game. It's
going quite well, except I've hit a wall on the timer.

At the moment it's a simple CLI interface, and what I need to do is
present the player with a list of letters, and give them 3 minutes to
enter as many words as they can from the list of letters.

I'm thinking that the easiest way to do this would be to wrap the game
logic in a while() loop for the 3 minutes.

I can't, however, find any examples of how to do this on the web or in
the newsgroups.

Can someone give me a hand?


thanks,
fnord

Check out the sleep command.

Shawn
 
E

Eric Frazier

Sleep doesn't help. He needs the Camel book and to look up alarm and the
%SIG hash, there is a good example of a timer there. He wants to wait
for input, but only for a certain amount of time. Sleep would wait, but
not allow the program to respond to input.

Eric
 

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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top