If you're using
CGI.pm (and you should), you can check to
see if a field is empty with the following code:
if (defined $q->param("this_is_your_field_name")) {
# do something spectacular
} else {
$fieldempty = 1;
# fail spectacularly
}
Since most code that doesn't use CGI.pm (and you should be
using it) at least puts fields in a hash, you can store
your fieldnames in an array and still do right:
my @fieldnames = qw( name rank serialnumber haircolor favoritebeverage
+ );
foreach my $field (@fieldnames) {
$fieldempty = 1 unless (defined $fields{$field});
}
# do something spectacular here unless a field is empty