use strict; use CGI qw/:standard/; if (param()) { if (param('email')=~/\w+@\w+/) { print header, start_html('Thank you'), h1('Thank you'), p, param('name'), ' now that we have your e-mail address we will send lots of nice spam to you at ', param('email'), '!', p; } else { formmaker('You must provide an email address!'); } } else { formmaker(); } sub formmaker { print header, start_html('A Form with Sticky Fields'), h1('A Form with Sticky Fields'), p; my $message = shift; print $message, p if $message; print start_form, "What's your name? ",textfield('name'),p, "What's your email? ",textfield('email'), p, ,p, submit, end_form, hr; }