in reply to Pattern match....
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern match....
by Anonymous Monk on Jan 21, 2009 at 08:29 UTC | |
by puudeli (Pilgrim) on Jan 21, 2009 at 09:54 UTC |