in reply to Resetting variables

Sadly you have not posted enough of your code to compile. Perhaps you can try to reduce the problem to the minimum set that still runs and exhibits the problem.

If you scope each session of the game and its variables so that when one cycle is complete they go out of scope you will not have to call a reset_game routine

use warnings; use strict; # variable we want to keep between runs my $high_score=0; my $play_it_again=1; while ($play_it_again) { my $last_score = play_game; $high_score = $last_score if $last_score > $high_score; $play_it_again=ask_user; } sub play_game { my $game_score=0; # game logic return $game_score; } sub ask_user { print "Do you want to play again (y or n)? "; my $play_again = <STDIN>; chomp($play_again); $play_again eq "y" ? 1 : 0 }

use strict; Don't know if you do as this is obviously a small frag of something bigger and you do appear to use my aplenty

Cheers,
R.