my ($quit, $next_print, $next_foo) = (0, 0, 0); while (!$quit) { <<>> my $cur_time = time; if (time > $next_print) { print "...\n"; $next_print = time+5; # wait 5s for next print } if (time > $next_foo) { foo(...); $next_foo = time+7; # wait 7s for next foo() } <<>> } #### my ($quit, $next_req, $cur_time, $cnt) = (0,0,0,0); while (!$quit) { <<>> if ($cur_time>> }