while ($word_len >= $tot_found) { if ($word_len == $tot_found) { print_word(); play_again(); } else { print_word(); if ($guessed_word == 0) { get_guess(); check_guess(); } else { play_again(); } } } sub get_guess { $guess = ; chomp($guess); } sub check_guess { my $occurrences = ""; my $guess_len = length($guess); print "\n$guess\n"; if ($guess !~ /[[:alpha:]]/) { print "\n***Invalid letter*** (hit any key)\n"; <>; } # other stuff... } sub play_again { print "Do you want to play again (y or n)? "; my $play_again = ; chomp($play_again); if ($play_again eq "y") { reset_game(); } else { last; } } sub reset_game { ($good_guesses, $bad_guesses) = ""; ($tot_found, $found_one, $occurrences, $all_occurrences, $guessed_word) = 0; } #### Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE ]/ at...