in reply to What do i need to read to ..

What bothers me a little is this:

while (my @rows = $sth->fetchrow_array() ) { return join '', map {sprintf $fmt, @$_ } \@headers, \@rows; } $sth->finish;

That's returning after fetching only a single row, and it also never calls the finish (unless, of course, no rows are returned).

Maybe this would be better?

my $result = sprintf $fmt, @headers; while ( my @rows = $sth->fetchrow_array() ) { $result .= sprintf $fmt, @rows; } $sth->finish; return $result;
We're building the house of the future together.