print_greeting(); reset_score(); OUTER: while ( 1 ) { my $current_question = ask_next_question(); my $attempts = 0; while ( $attempts++ < $MAX_ATTEMPTS ) { my $answer = get_answer(); last OUTER if $answer eq 'q'; last if check_answer( $current_question, $answer ); print_sorry_try_again(); } if ($attempts < $MAX_ATTEMPTS ) { print_congratulations(); update_score( 1 ); } else { explain_correct_answer( $current_question ); update_score( 0 ); } } print_score(); print_good_bye();