#!/usr/bin/perl -wT use strict; use CGI qw/:standard/; my %errors; my ( $candidate ) = ( param( 'candidate' ) =~ /^([\s\w]+)$/ ); # candidate must be defined and have at least one non-whitespace character if ( ! defined $candidate or $candidate !~ /\S/ ) { $errors{ candidate } = 'You must supply a value for candidate'; } # grab more params and untaint if ( %errors ) { display_page_with_errors( \%errors ); }