I spotted the lack of * shortly after posting.

re .*: having eliminated the first column and its delimiter, .* must be what is left over as the second and last column - why make the engine work harder?. It really is quite common that the remainder of a string is defined by elimination of specific features of the preceding characters and needs no further analysis - only when the .* is attempted earlier than such elimination is completed does it cause a problem.

re "if" - I opted for this rather than allowing any exceptions to just fall through the code, whereas no else is defined because neither was any provision for such exceptions stated in the requirement. Not seeing the benefit of this turns out to be a trap for habitual negative thinking: If there was a blank line in the data, your own solution, which apart from not filtering exceptions is fine, would accept the blank data and, for example, enter it into the database!

-M

Free your mind


In reply to Re^3: CSV file by Moron
in thread CSV file by azaria

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.