Since being informed about Text::XSV, in such circumstances, I tend to use nothing else but it:
use warnings; use strict; use Text::xSV; my $csv = Text::xSV->new(fh => *DATA, row_size_warning => undef); while (my $row = $csv->get_row()) { my @prefix = splice @$row, 0, 3; foreach (@$row) { print join ',', @prefix, $_ . "\n"; } } __DATA__ 1401,PERISH STORE INV,Quarterly,(V) INV810 USER NAME (EDIT REPORT IF 0 +5309 PRSH INV),EXTRACT WAS RUN),(V) INV820 USER NAME (PERISHABLE INVE +NTORY REPORT),(VTD8) D:\DEPT\ACCT\MAIL\INV820.DAT,(V) INV820C USER NA +ME (PERISHABLE INVENTORY-BAKERY),(QUARTERLY RUN ONLY) 1402,PERSH INV BOOKS,Quarterly,(V) INV805 58 COPIES - USER NAME,(V) IN +V805 2 COPIES - USER NAME,(V) INV805A XTRA COPIES-SAVE IN COMPUTER RO +OM,ANNUAL STORE INVENTORY ONLY:,(V) INV805 58 COPIES - USER NAME,(V) +INV805 2 COPIES - USER NAME,(V) INV805A XTRA COPIES-SAVE IN COMPUTER +ROOM 1403,BAKERY INV BOOKS,Quarterly,(V) INV805 35 COPIES - USER NAME,(V) I +NV805A 5 COPIES - SAVE IN COMPUTER ROOM,ANNUAL STORE INVENTORY ONLY:, +(J) INV805 35 COPIES - USER NAME,(J) INV805A 5 COPIES - SAVE IN COMPU +TER ROOM 1501,INV PRICE GUIDE,As Needed,(V) MSC052 BOTH COPIES ARE TO BE PUT IN + BINDERS AND,AND LEFT ON THE CABINETS BEHIND THE DP,SECRETARY'S DESK
Which is, IMHO, not too unreadable (:-D) and when run, gives:
$ perl tst.pl 1401,PERISH STORE INV,Quarterly,(V) INV810 USER NAME (EDIT REPORT IF 0 +5309 PRSH INV) 1401,PERISH STORE INV,Quarterly,EXTRACT WAS RUN) 1401,PERISH STORE INV,Quarterly,(V) INV820 USER NAME (PERISHABLE INVEN +TORY REPORT) 1401,PERISH STORE INV,Quarterly,(VTD8) D:\DEPT\ACCT\MAIL\INV820.DAT 1401,PERISH STORE INV,Quarterly,(V) INV820C USER NAME (PERISHABLE INVE +NTORY-BAKERY) 1401,PERISH STORE INV,Quarterly,(QUARTERLY RUN ONLY) 1402,PERSH INV BOOKS,Quarterly,(V) INV805 58 COPIES - USER NAME 1402,PERSH INV BOOKS,Quarterly,(V) INV805 2 COPIES - USER NAME 1402,PERSH INV BOOKS,Quarterly,(V) INV805A XTRA COPIES-SAVE IN COMPUTE +R ROOM 1402,PERSH INV BOOKS,Quarterly,ANNUAL STORE INVENTORY ONLY: 1402,PERSH INV BOOKS,Quarterly,(V) INV805 58 COPIES - USER NAME 1402,PERSH INV BOOKS,Quarterly,(V) INV805 2 COPIES - USER NAME 1402,PERSH INV BOOKS,Quarterly,(V) INV805A XTRA COPIES-SAVE IN COMPUTE +R ROOM 1403,BAKERY INV BOOKS,Quarterly,(V) INV805 35 COPIES - USER NAME 1403,BAKERY INV BOOKS,Quarterly,(V) INV805A 5 COPIES - SAVE IN COMPUTE +R ROOM 1403,BAKERY INV BOOKS,Quarterly,ANNUAL STORE INVENTORY ONLY: 1403,BAKERY INV BOOKS,Quarterly,(J) INV805 35 COPIES - USER NAME 1403,BAKERY INV BOOKS,Quarterly,(J) INV805A 5 COPIES - SAVE IN COMPUTE +R ROOM 1501,INV PRICE GUIDE,As Needed,(V) MSC052 BOTH COPIES ARE TO BE PUT IN + BINDERS AND 1501,INV PRICE GUIDE,As Needed,AND LEFT ON THE CABINETS BEHIND THE DP 1501,INV PRICE GUIDE,As Needed,SECRETARY'S DESK
Update:

In retrospect i.e. whilst watching my daughter learning to swim, it occurred to me that I probably ought to recommend the use of the print() &/or print_row() methods (of Text::xSV) to generate the output.

A user level that continues to overstate my experience :-))

In reply to Re: Generating an output file by Bloodnok
in thread Generating an output file by TStanley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.