Update: One should read the whole problem description before running into conclusions...
Update2:If you require only the first block and not all select statements, then in addition to the examples in my post you would have to recognize when to stop collecting lines from the input.
You go through the input line by line and select only those lines that are of interest. Something along these lines:
# Reading from a prepopulated array my @wanted; foreach my $line ( @input ) { push $line, @wanted if $line =~ /^SELECT poid/; }
or
# Reading from a filehandle my @wanted; foreach my $line ( <$input_fh> ) { push $line, @wanted if $line =~ /^SELECT poid/; }
or
my @wanted = grep { /^SELECT poid/ }, @input;
Note, all code is untested.
In reply to Re: Pattern match....
by puudeli
in thread Pattern match....
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |