Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
If these conditions are met:
  1. There are always 5 Fields
  2. Additional commas only appear in the fifth field
  3. then this code will give you the desired result:
    while ($line=<DATA>) { chomp $line; ($char, $num1, $num2, $num3, $commafield)=split(/,/,$line,5); print <<MYDATA; $char $num1 $num2 $num3 $commafield ------- MYDATA } __DATA__ R,2164,27-2164,270102,Add Terminal Server to John, Jane, and Georges $,1111,22-2222,333333,Ignore mails from support, microsoft or bill

    In reply to Re: How can I read a file that is comma delimited but includes a comma in the string? by Skeeve
    in thread How can I read a file that is comma delimited but includes a comma in the string? by Anonymous Monk

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



  4. Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  5. Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  6. Please read these before you post! —
  7. Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  8. Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  9. Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  10. See Writeup Formatting Tips and other pages linked from there for more info.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-11-28 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (199 votes), past polls