#!/usr/bin/perl -w use strict; use CGI; # create CGI object my $q = new CGI; # create list of fields to check my @non_empty_form_fields = qw(name email address tel); # store errors here my @err = (); # check fields exist for (@non_empty_form_fields) { unless ( $q->param($_) ) { push @err, "You must complete the '$_' field"; } } # if error, represent if (@err) { # read in form open (FORM,'/path/to/form.html') || die $!; my $form = join '', (