For CSV, use Text::CSV_XS. It will take care of all the CSV creation. I assume you have Excel or OpenOffice, so you can load it in and print it as you like. If you have something else in mind, you might consider saying it instead of leaving us to guess.