in reply to adding database values to csv file
Also see Querylet and Querylet::CGI, which do just that (and little more).