in reply to loop execution for "time" specified

perlpal,
The obvious problem has already been pointed out to you, but there are some additional things you might want to consider. For instance, if $_time_offset is a negative number, you still introduce an infinite loop. Additionally, you have no sleep before the next iteration of your loop. If execute_attack() doesn't do as you expect, this could turn into a runaway CPU hog. On the other hand, if execute_attack() itself becomes a long running process - you still may run longer than you want - see alarm and %SIG in perlvar for a potential solution.

You should be able to take the ideas I am providing and build on them. If you don't understand or come up short, come back and ask for more help - but keep in mind that with a sub name like execute_attack(), we will likely want a better explanation of what your code is doing before helping further.

Cheers - L~R

  • Comment on Re: loop execution for "time" specified