$template->param( warnings => \@warning ) || die $!; #### #!/usr/bin/perl use strict; use HTML::Template; use MIME::Lite; use CGI; use CGI::Carp qw/fatalsToBrowser/; use Data::Dumper; my $c = new CGI; validate( qw/ email phone/ ); my $c = new CGI; print $c->header,$c->start_html('everythings ok'); sub validate { my $c = new CGI; my @params = @_; my @warning; for ( @params ) { push (@warning, { 'missing' => $_ }) unless $c->param($_); } if ( @warning ) { print $c->header; my $template = HTML::Template->new(filename => './templates/warning.html'); $template->param( warnings => \@warning ) || die $!; $template->output() || die $!; print Dumper @warning; exit; } } #### Content-type: text/html Software error: Died at /var/www/cgi-bin/ebranch/assignment/process.cgi line 28. For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error. #### Warning! The following fields are missing.