#! /usr/bin/perl use strict; use warnings; use HTML::Template; my $tmpl_file = '/path/to/template.tmpl'; my $template = HTML::Template->new(filename => $tmpl_file); my %errors = (klein => 5, mittel => 10, groß => 1); my @array; foreach my $key(keys(%errors)){ push(@array,{CATEGORY => $key, NUMBER => $errors{$key}}); } $template->param(ERRORS => \@array); my $target = '/path/to/ziel.html'; open(my $fh,">$target") or die $!; print $fh $template->output(); close $fh;