The best thing would be to set $/ to some kind of record separator such that your my @unclean = <LST> actually sucks in one record per array entry rather than one line ($/ is the input record separator, usually "\n", so <LST> reads in a line at a time). However, without more information it's difficult to tell what a good value would be.

It looks as if every record is separated by a line consisting of "N/A N/A\n"; if that's true, then try setting $/ = "N/A N/A\n" ("\nN/A N/A\n" might be safer — matches a line containing exactly N/A N/A, not simply ending in N/A N/A) and taking a look at what you get in @unclean (more info in perlvar docs). If that works then you might also want to investigate using /s and/or /m as modifiers on your regexp (these modify how regexps process newlines - more info in perlop docs).

HTH…


In reply to Re: Capturing Multiple lined data with regex. by conrad
in thread Capturing Multiple lined data with regex. by blackadder

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.