sub foo { #process the event if(rand() > 0.5) { foo(); } } foo();