my $dbh =DBI->connect( "dbi:$dbidriver(RaiseError=>1,Taint=>1):dbname=$dbname;host=$dbhost", "$dbusername", "$dbpassword", ); my $statement= "select name from names"; my $sth = $dbh->prepare($statement); $sth->execute(); ##grab all rows as array ref my $site = $sth->fetchall_arrayref; $sth->finish; $dbh->disconnect; my %stuff; ##push everything into a hash foreach my $site_in ( @{$site} ) { push @{ $stuff{view} }, { name => $site_in->[0], }; } #load file my $template = HTML::Template->new( filename => catfile( foo.tmpl ), die_on_bad_params => 0 ); #load in hash $template->param( {%stuff} ); #print out print $template->output; ####
name