Ninth Prince has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I would like to add a condition to a while loop that exits the loop if the code has been executing for certain amount of time. For example I would like the while to exit if ($count>100 or time>60 minutes). Is there a standard way for doing this? I don't need anything fancy. I just want to be able to set the program to run for a couple of hours (if need be) and then stop.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Running code a certain amount of time
by ccn (Vicar) on Oct 31, 2008 at 15:02 UTC | |
|
Re: Running code a certain amount of time
by Limbic~Region (Chancellor) on Oct 31, 2008 at 17:50 UTC | |
|
Re: Running code a certain amount of time
by blazar (Canon) on Nov 01, 2008 at 09:52 UTC | |
|
Re: Running code a certain amount of time
by zentara (Cardinal) on Nov 01, 2008 at 13:16 UTC | |
|
Re: Running code a certain amount of time
by mpeever (Friar) on Oct 31, 2008 at 16:34 UTC | |
|
Re: Running code a certain amount of time
by afresh1 (Hermit) on Oct 31, 2008 at 18:57 UTC |