if (fork()) { $children_spawned++; return 1; } else { # Here, the *very first* child won't have $children_spawned unless ($children_spawned) { print "I'm the first!\n"; &do_main_with_timed_event_processing; } else { &do_main_without_timed_events; } }