use DBI; # do DBI things, like connecting to the database, statement # preparation and execution use GD::Graph::Data; use GD::Graph::bars; my $data = GD::Graph::Data->new(); while (@row = $sth->fetchrow_array) { $data->add_point(@row); } my $chart = GD::Graph::bars->new(); my $gd = $chart->plot($data);