in reply to Re^6: Writing Multiple Recordsets into a CSV file
in thread Writing Multiple Recordsets into a CSV file

Try fetchrow_hashref() instead of fetchrow_arrayref(). You are using Data::Dumper. It dumps. It does not format. You have to do the formatting yourself. Read up of Perl hashes for a start.
--
Andreas