my $next = time; while (1) { $next = time if $next < time; $next += 6; FONCTION1; FONCTION2; sleep $next - time; }