use constant STEPS_IN_MILE => 2000; # rough estimate based on www.thewalkingsite.com/10000steps.html my $step_counter = 0; # I'll presume you are just starting out... my $current_state = 'walking'; # but you are trying! while ($current_state eq 'walking') { $step_counter++; $step_counter++ if ( $step_counter/STEPS_IN_MILE > 500 ); # don't you think you've dawdled long enough? Pick up the pace! (more of a jog at this point) $current_state = 'fallen down' if ( $step_counter/STEPS_IN_MILE > 1000 ); # do ring the gong before falling, the kind Monks will surely fetch you water. }