http://www.perlmonks.org?node_id=416849


in reply to Problems Processing Hash within Cgi Script

First I think that yoou should make sure that your hash is populated
(something that you've probably done :p )
Anyway I thing that the best method is to put some warnings during the processing
in order to make sure that it is processed correct.
Anyway another good practice is to send the html to a variable and then print it.
It avoid to have the page breaked in the middle when an error occurs.
Generally we would like to use something like this:
my $html = qq {<SELECT NAME="partNumber" SIZE="1" >}; foreach my $key (sort keys %{$HASHDATAFROMLIBRARYFILE{TIMING}}) { #my $p = \%{$rpt{$HASHDATAFROMLIBRARYFILE}{TIMING}{$key}}; warn "\n Here we are $key "; # just to make sure it is executed $text .= qq { $html .= qq { <OPTION VALUE='$keys' @{[ ( ( defined($rpt{PART_NUMBER}) ) && ($FORM{CellName} eq $keys ) ) ? 'SELECTED' : '' ]} >$keys</OPTION> }; }

I hope it could help you.