my %cookies = CGI::Cookie->fetch; my $score = $cookies{score}->value; $score = 0 unless $score eq authenticated_score($score); # (play game here, adding 1 to $score if this is a win) log_winner() if $score >= 100; $score = authenticated_score($score); my $cookie = CGI::Cookie->new(-name => 'score', -value => $score); print header(-cookie=>$cookie); # (send the rest of your HTML to the player.)