DAVERN,
There are many ways to do this because one of Perl's mottos is there is more than one way to do it.

The first method is probably the most common and easiest to think of. At the top of the loop, skip lines that you don't want

while (<DATA>) { next if ! /^DATA/; # ...

Another common first step might be to throw away the first N lines

<DATA> for 1 .. 3; while (<DATA>) { # ...

Sometimes it gets more complicated and you need to check a state variable against multiple lines. I won't give you an example of that abstract case but I will show you what some people do:

my $found_start_of_data; while (<DATA>) { last if $found_start_of_data; # ... some complex code that sets the flag } while (<DATA>) { # ... }
The above has a micro-optimization which you should avoid unless you need it. Essentially, it avoids paying the penalty of checking to see if we are in the good data against all lines and starts a new loop with only the processing we care about.

The final method I will share is where you extract or eliminate what you don't want.

# Extract my ($want) = $data =~ m{(some_regular_expression)}; # Eliminate $data =~ s{some_regular_expression}{};
As you can see, there are many ways to do what you are looking to accomplish. If you don't understand something, please ask.

Cheers - L~R


In reply to Re: text processing by Limbic~Region
in thread text processing by DAVERN

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.