my (@ergebnisse,$set); while(my @result = $sth->fetchrow_array()){ $result[2] = ''.$result[2].'' if($result[2] == 4); $set = '' if($result[2] == 4); my %hash = ( ID => $result[0], NAME => $result[1], CAT => $result[2], CHECKED => $set,); push(@ergebnisse,\%hash); } $template->param(ABFRAGE => \@ergebnisse);