in reply to Maximum End Time

mantra2006,
It sounds like what you want is alarm. The code would look something like:
print $time_out_request_msg; my $time_out = <STDIN>; chomp $time_out; if (valid_timeout($time_out)) { $SIG{ALRM} = sub { # ... }; alarm $time_out; } while (1) { # ... }

Update: The original node was modified by mantra2006 a couple of times after this reply so this reply may no longer be pertinent as a result.

Cheers - L~R