You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
825 B
Perl

#!/usr/bin/perl
use warnings;
use CGI::Pretty qw(:all);
use strict;
my $cgi=new CGI;
print header();
if ($cgi->param('first') and $cgi->param('last')) {
my $first=ucfirst(lc($cgi->param('first')));
my $last=ucfirst(lc($cgi->param('last')));
print start_html("Welcome"),h1("Hello, $first $last");
} else {
print start_html(-title=>"Name");
if ($cgi->param('first') or $cgi->param('last')) {
print center(font({-color=>'red'},"You must enter a",($cgi->param('last')?"first":"last"),"name"));
}
print generate_form();
}
print end_html();
sub generate_form {
return start_form,
h1("Please enter your name:"),
p("First name", textfield('first')),
p("Last name", textfield('last')),
p(submit),
end_form;
}