sub do_step_one { print " step one: $_[ARG0]\n"; $_[KERNEL]->yield('step_two', $_[ARG0]) if rand(1) > 0.5; $_[KERNEL]->yield('process_next_input') if $poe_kernel->get_event_count() == 0; } sub do_step_two { print " step two: $_[ARG0]\n"; $_[KERNEL]->yield('process_next_input') if $poe_kernel->get_event_count() == 0; }