sub tables { my @rows = ( ... ) ; # Load new template to add to main template later my $table_tmpl = HTML::Template->new(filename => 'templates/table.tmpl', die_on_bad_params => 0,); #Load these values into the template $table_tmpl->param( DATA => \@rows, ); # Load this template into main template my $table_load = $table_tmpl->output(); return $table_load; } 1;