use strict ; use warnings ; use CGI ; use CGI::Carp qw(fatalsToBrowser); use Data::Dumper ; use Data::Dump 'pp'; use InfoD; use HTML::Template; my $q = CGI->new; start(); sub start { my $return_val_from_tables = tables(); # Main Template my $main_tmpl = HTML::Template->new(filename => 'templates/main.tmpl', die_on_bad_params => 0,); # load values into the main template my $name = "Proto"; $main_tmpl->param( NAME => $name, STUFF => 'TEST', LOAD => $return_val_from_tables->output(), ); print $q->header, $main_tmpl->output; } #### 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;