my $errstr = ''; for my $param( qw( name email phone url requests ) ) { $errstr .= "Please enter your $param
\n" unless defined param($param); } # if $errstr is true we have some errors, so tell user if ( $errstr ) { print "Content-Type: text/html\n\n"; print "

Please click back and correct these error(s):\n

" . $errstr; exit 0; } # got data OK so continue processing