in reply to Parsing an SQL table using an array of hashes?
you could also go for
Now what is the real question?
How to get the input from SQL or how to get the output to GD::Graph ?
(addicted to the Perl Programming Language)