b0VIM 8.2( b@perlcgiperlcgi/var/cgi-bin/guess_number.cgi U3210#"! UtpGad;sGdPH" c b ; S ( d c .  I  >  s`C process_guess( $game->par process_guess( process_guess( $game->param( 'guess' ) || '', $state );my ( $message, $status ) =# process current guess, if any} $state = initialize( $state );if ( !$state || $game->param( 'restart' ) ) {# or if we are playing another game ($game->param( 'restart' )).# initialize state if we are starting from the beginning (!$state)my $state = get_state();# retrieve current state} 'lost') unless ($state->{GUESSES_LEFT} && $guess != $state->{NUMBER}); return ("Sorry, you ran out of turns. The number was $state->{NUMBER}.", # incorrect guess and out of tries $state->{GUESSES_LEFT}--; $state->{GUESSED} = join ',' sort keys %guessed; $guessed{ $guess } = 1; # we have a valid guess. update list of guesses if $guessed{ $guess }; return ("You already guessed that number.", 'error') # check if user already entered this guess previously unless $guess =~ m/^[1-9][0-9]?$|^100$/; return ("Not a valid guess.", 'error') # ensure guess is a valid number between 1 and 100 return ("Did not enter a guess", 'continue') unless $guess; # do nothing if user did not enter a guess my %guessed = map { $_ => 1 } split /,/, $state->{GUESSED}; # process list of previous guesses my ( $guess, $state ) = @_;sub process_guess {} return $state; $state->{GUESSED} = ''; $state->{WON} += 0; $state->{GUESSES_LEFT} = TRIES; $state->{GAMENO} += 1; $state->{NUMBER} = int( rand( 99 ) ) + 1; $state = {} unless $state; my $state = shift;sub initialize {} return $state; } $state->{ $_ } = $game->param( $_ ); foreach ( qw[ NUMBER GAMENO GUESSES_LEFT WON GUESSED ] ) { my $state = {}; return undef unless $game->param();sub get_state {my $game = CGI->new;use constant TRIES => 5;use CGI;use strict;use warnings;#!/usr/bin/perl