in reply to Stupid parsing question

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)

Replies are listed 'Best First'.
Re: (jeffa) Re: Stupid parsing question
by dew (Novice) on Nov 27, 2001 at 21:14 UTC
    Thanks, that did it. Really appreciate the help. I hate duh-land.