in reply to (jeffa) Re: How can I display an entire MySQL table in Perl?
in thread How can I display an entire MySQL table in Perl?

If all you want to do is dump the contents of a SELECT statement to an HTML table, use the Power of the CGI module. Instead of this (from jeffa):
# html-table style print "<table>\n"; foreach my $row (@$res) { print "\t<tr>\n"; print map { "\t\t<td>$_</td>\n" } @$row; print "\t</tr>\n"; } print "</table>\n";
I would do this:
use CGI qw(:standard *table); use CGI::Pretty; # For pretty-printed HTML print start_table; print Tr(td($_)) foreach @$rows; print end_table;
Yes, it's just that easy. Of course, the more general solution is using some sort of templating scheme, but in general this is a pretty sweet way of outputting dynamic table data on the fly.

Gary Blackburn
Trained Killer