sub validate { my @params = @_; my @warning; for ( @params ) { my %h = ( missing => $_); push (@warning, \%h ) unless $c->param($_); } if ( @warning ) { print $c->header; my $template = HTML::Template->new(filename => './templates/warning.html'); #don't use die $! while testing HTML::Template has it's own error handling $template->param( warnings => \@warning ); print $template->output(); exit; } }