UPDATE from rkaminski: I really appreciate all the replies, Wow! The vendor does not use full CSV format, or CSV header records, and hasn't for 20 years, and doesn't plan to, so all of the module techniques mentioned, while certainly the correct way to go in true CSV situations, do not seem to apply to this admittedly strange special case. I did learn a lot about proper CSV techniques, and for that I thank you all. However, the magical regular expression idea from the FAQ, (modified slightly to use ' instead of ") worked great. Here is the updated code, which works well enough, although I suspect that there is a more perlish way to do it. I was also really impressed by the contributor (ruzam) who modified it even farther to deal with ', " and extra spaces, which surpassed my needs but was excellent for folks who have even odder input than I do!
@inline=(); push(@inline, $+) while $pre_inline =~ m{'([^\'\\]*(?:\\.[^\'\\]*) +*)',? | ([^,]+),?| , }gx; push(@inline, undef) if substr($pre_inline,-1,1) eq ','; $semi_thirty_char_node_key = $inline[0]; $mem_size = $inline[4]; $spec = $inline[5]; $num_proc = $inline[6]; $model = $inline[10]; $os = $inline[11]; $alias = $inline[14]; $perf_rate_type = $inline[15]; $node_mode = $inline[18]; $num_logical_processors = $inline[19];
The input data was:
;pdbdevd1 Olx8jQCKrnQvrA0,'IBM eServer p5 595 1900MH',pdbdevd1,I +BM_P5_595_1900,4096.000000,394.848511,27,,,,IBM_p5_595_1900,AIX,,,pdb +devd1,SPECINTRATE2000,EST,'IBM,02028C8AD',LOGICAL,2,DLPAR,SMT
So, instead of using the split with undefs I resorted to indexing off of $inline, but it worked! granted, timtowtdi, but if you have a more elegant way, please comment. Thanks to all who helped so far! I will try to help others in the future too!

In reply to Re: A better way to split CSV files with quoted strings that may contain commas? by rkaminski
in thread A better way to split CSV files with quoted strings that may contain commas? by rkaminski

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.