my $dbh = DBI->connect( 'connect string','user','pass', {RaiseError=>1, HandleError => \&bail_out}, }; #### my $sth = $dbh->prepare("select * from foo"); $sth->execute; print table( Tr [ th($sth->{NAME}), map {map td($_), @$_} $sth->fetchall_arrayref ] );