in reply to text to csv file format
I can't see where you have run into trouble because you haven't provided the code you have tried and are having trouble with. You may find that Text::xSV is of some help however.