Clueless newbie question about iterating over selected regions of a file.

I have in input file structured something like this:

*** Iteration 1
data,data,data,data,data
data,data,data,data,data
data,data,data,data,data

*** Iteration 2
data,data,data,data,data
data,data,data,data,data
data,data,data,data,data

*** Iteration 3
data,data,data,data,data
data,data,data,data,data
data,data,data,data,data

and so on. My goal is to process the data in each iteration separately, so
the output would look something like:

iteration_1,result,result,result,result,result
iteration_2,result,result,result,result,result
iteration_3,result,result,result,result,result

I have a subroutine that works fine for processing a file with just one
iteration. BUT I am totally stuck on handling multiple iterations. The
following does NOT work:

while (<INPUT>) {
        if (my $tmp =~ /Iteration 1/) {
                until ($tmp =~ /Iteration 2/) {
                        if (/^(.*)$/sm) {
                                push (@aa, $1);
                        }
                }
                next;
        }

          # do stuff to $aa[whatever] here
}


any suggestions gratefully accepted

thanks

David Newman



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to