First of all, please use strict and use warnings and for good measure use diagnostics. Those three lines will save you a lot of pain.

Second of all, your regular expression is "not working", because you have escaped the dollar sign at the end of your pattern. So the pattern is looking for a literal dollar sign, not the end of line as I presume you intended.

Third of all, that is one remarkably inefficient regular expression! It took over a minute to run on my machine. If you just change each greedy ".*" to a non-greedy ".*?" it runs in no time. (Also your one line of sample data is missing a trailing "|" symbol.)


In reply to Re: Parsing delimited file contents by gmargo
in thread Parsing delimited file contents by idy

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.