You are not giving enough info - what does the 'next indicator' look like? I will go ahead and assume one.

Pointers - pass args to subroutines, don't rely on globals. Second, don't name a filehandle DATA, because there is already a built-in DATA filehandle. Third, use a regex on a scalar that contains the file contents, not a for loop on an array.

Check this out:

use strict; my $contents = do {local $/; <DATA>}; print get_chunk($contents); sub get_chunk { my ($contents) = @_; my $start = qr|========= Summary of bfpr_catfl results ===\s*|; my $end = qr|========= end ===\s*|; my ($chunk) = $contents =~ /$start(.*)$end/s; return $chunk; } __DATA__ you won't see this or this ========= Summary of bfpr_catfl results === you will see this and this ========= end === you won't see this or this or that
See perlre for more info on regexes and the 's' option and perlop for info on 'qr'.

UPDATE:
I notice you tend to group variables together with a common prefix - BFPRCONS - you should try a global hash (not all globals are bad):

my %BFPRCONS = ( filename => 'whatever_the_name_is', count => 0, start => qr|===== summary blah ===|, end => qr|===== end blah ===|, ); # then you could inc the count like so: $BFPRCONS{'count'}++; # you could set the file name like so: $BFPRCONS{'filename'} = join ('_',$job,$junk1,$etc);

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)

In reply to (jeffa) Re: Stupid parsing question by jeffa
in thread Stupid parsing question by dew

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.