use DBI; use CGI ':standard'; use Data::Table; use strict; my $dbh = DBI->connect(...); my $table = Data::Table::FromSQL( $dbh, "select * from mytable where myfield = ?", 'whatever'); print header, start_html('Results'), $table->html;