use Term::Choose::Table qw( print_table ); my $table = [ [ 'id', 'name' ], [ 1, 'Ruth' ], [ 2, 'John' ], [ 3, 'Mark' ], [ 4, 'Nena' ], ]; print_table( $table ); use DBI; my $dbh = DBI->connect( ... ); my $sth = $dbh->prepare( "SELECT * FROM table" ); $sth->execute(); my $a_ref = $sth->fetchall_arrayref(); unshift @$a_ref, $sth->{NAME}; my $opt = { ... }; print_table( $a_ref, $opt );