in reply to Create CSV File
I strongly agree with the above. CPAN provides you with a cornucopia of tested tools for doing a great many things... simple things, like this one, and immensely complex things too. IMHO, it is always advisable to “search CPAN first,” and to use what you find there in preference to “rolling your own.”
If you’re not sure whether you will continue using a particular package as your application grows, simply build an application-specific “wrapper” package (of your own design) that properly reflects its calls to the CPAN module(s) of choice. This will confine any future re-implementation efforts to that one “wrapper.”