Hi!
If you want to wait a few seconds before taking an action, use the
sleep(), becouse loops like yours strongly occupy your machine.
sleep() works great with full number of seconds, but if you need delays below 1 sec or for example 1.7 sec, then use
Time::HiRes module from
CPAN. It works fine and should fit well :-)
BTW. CPAN has a nice
search engine...
Good luck!