All:
I have already thought of, and have working code for, an iterative solution for my problem. I am just wondering if there is a way to slurp my records in if for no other reason than to learn a neat new trick.

My data file looks something like the following:

Field 1: abc Field 2: asdfasdf Field 2: asdfasdfase Field 2: aaa Field 3: ss Field 1: def Field 2: abc123 Field 3: blah Field 1: asdfa
Where the record is from Field 1 through Field 3 and there can be varying amounts of Field 2 in between. I know that $/ works off of a string and not a RE, so I am not sure this is possible. tye showed me a neat way to match a single character on a line by itself $/ = "\nB\n";. In this case though, I am looking to terminate on the newline between the end of line in Field 3 and the start of line in Field 1, without getting any of the actual data in Field 3 or 1.

Anyone know of a way to do this or should I stick with my iterative solution that uses a flag to see when I am starting a new record?

Thanks in advance - L~R


In reply to Help to slurp records - $/ maybe? by Limbic~Region

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.