in reply to JSON module

At a guess, I think you'd do something like this:

#!/usr/bin/perl use DBI; use JSON; ... $sth->execute(); while (my $hr = $sth->fetchrow_hashref) { push @array, $hr; } my $json = JSON->new; print $json->objToJson(@array);

Caveat emptor, etc.