.+?)($default_template_title)(.+?<\/h2>)/$1$article_title$3/s; # change the article title
}
else
{
####################################
####################################
# Read top HTML page template
$html_template_top = $html_template . "_top_pl.html";
open(TOP, "<./templates/$html_template_top") or die "Cannot open file \'$html_template_top\' $!";
while ($line = )
{
$top .= $line;
}
close TOP;
$top =~ s/(.+?)($default_template_title)(.+?<\/h2>)/$1$article_title$3/s; # change the article title
####################################
####################################
# Read bottom HTML page template
$html_template_bottom = $html_template . "_bottom_pl.html";
open(BOTTOM, "<./templates/$html_template_bottom") or die "Cannot open file \'$html_template_bottom\' $!";
while ($line = )
{
$bottom .= $line;
}
close BOTTOM;
}
####################################
####################################
print "$top\n";
####################################
####################################
#### MY PERL CODE COMES IN HERE ####
####################################
my $cgi = CGI->new;
my %param = map {$_ => scalar $cgi->param($_)} $cgi->param();
# for my $key (sort keys %param)
# {
# print join ": ", $key, $param{$key};
# print "
\n";
# }
# Guess the random number from 0 to $upper_limit!
$upper_limit = 200;
#############
# INPUT PROCESSING
if ($param{'submit'} eq "Sprawdź!")
{
$random_number = $param{'random_number'};
$user_number = $param{'user_number'};
if ($user_number eq '')
{
$user_number = 0;
}
$attempt = $param{'attempt'};
$attempt++;
if ($user_number < $random_number)
{
print "\n\nTwoja liczba $user_number jest zbyt mała! Spróbuj ponownie! Próba nr $attempt
\n\n";
}
elsif ($user_number > $random_number)
{
print "\n\nTwoja liczba $user_number jest zbyt duża! Spróbuj ponownie! Próba nr $attempt
\n\n";
}
else
{
print "\n\nGratulacje!!!\n\nWylosowana liczba to $user_number.\n\nOdgadłeś ją za $attempt. razem!!!
\n\n";
#############
# INPUT FORM
print "\n";
}
}
else
{
$random_number = rand($upper_limit+1);
$random_number = int($random_number);
$user_number = -1;
$attempt = 0;
}
if ($user_number != $random_number)
{
#############
# INPUT FORM
print "\n";
}
print "
";
####################################
########## END OF MY CODE ##########
####################################
print "\n";
print "$bottom";
.+?)($default_template_title)(.+?<\/h2>)/$1$article_title$3/s; # change the article title
####################################
####################################
# Read bottom HTML page template
$html_template_bottom = $html_template . "_bottom_pl.html";
open(BOTTOM, "<./templates/$html_template_bottom") or die "Cannot open file \'$html_template_bottom\' $!";
while ($line = )
{
$bottom .= $line;
}
close BOTTOM;
}
####################################
####################################
print "$top\n";
####################################
####################################
#### MY PERL CODE COMES IN HERE ####
####################################
my $cgi = CGI->new;
my %param = map {$_ => scalar $cgi->param($_)} $cgi->param();
# for my $key (sort keys %param)
# {
# print join ": ", $key, $param{$key};
# print "
\n";
# }
# Guess the random number from 0 to $upper_limit!
$upper_limit = 200;
#############
# INPUT PROCESSING
if ($param{'submit'} eq "Sprawdź!")
{
$random_number = $param{'random_number'};
$user_number = $param{'user_number'};
if ($user_number eq '')
{
$user_number = 0;
}
$attempt = $param{'attempt'};
$attempt++;
if ($user_number < $random_number)
{
print "\n\nTwoja liczba $user_number jest zbyt mała! Spróbuj ponownie! Próba nr $attempt
\n\n";
}
elsif ($user_number > $random_number)
{
print "\n\nTwoja liczba $user_number jest zbyt duża! Spróbuj ponownie! Próba nr $attempt
\n\n";
}
else
{
print "\n\nGratulacje!!!\n\nWylosowana liczba to $user_number.\n\nOdgadłeś ją za $attempt. razem!!!
\n\n";
#############
# INPUT FORM
print "\n";
}
}
else
{
$random_number = rand($upper_limit+1);
$random_number = int($random_number);
$user_number = -1;
$attempt = 0;
}
if ($user_number != $random_number)
{
#############
# INPUT FORM
print "\n";
}
print "
";
####################################
########## END OF MY CODE ##########
####################################
print "\n";
print "$bottom";
\n"; # } # Guess the random number from 0 to $upper_limit! $upper_limit = 200; ############# # INPUT PROCESSING if ($param{'submit'} eq "Sprawdź!") { $random_number = $param{'random_number'}; $user_number = $param{'user_number'}; if ($user_number eq '') { $user_number = 0; } $attempt = $param{'attempt'}; $attempt++; if ($user_number < $random_number) { print "\n\nTwoja liczba $user_number jest zbyt mała! Spróbuj ponownie! Próba nr $attempt
\n\n"; } elsif ($user_number > $random_number) { print "\n\nTwoja liczba $user_number jest zbyt duża! Spróbuj ponownie! Próba nr $attempt
\n\n"; } else { print "\n\nGratulacje!!!\n\nWylosowana liczba to $user_number.\n\nOdgadłeś ją za $attempt. razem!!!
\n\n"; ############# # INPUT FORM print "\n"; } } else { $random_number = rand($upper_limit+1); $random_number = int($random_number); $user_number = -1; $attempt = 0; } if ($user_number != $random_number) { ############# # INPUT FORM print "\n"; } print "
"; #################################### ########## END OF MY CODE ########## #################################### print "\n"; print "$bottom";