I think I can give you some clues. Here's some code out of the Perl Cookbook (6.8
Extracting a Range of Lines), which I've adapted for you. You should be able to nest
such structures to get what you want.
my $extracted_lines = '';
while (<>) {
if (/BEGIN PATTERN/ .. /END PATTERN/) {
# line falls between BEGIN and END in the
# text, inclusive
$extracted_lines .= $_;
} else {
# now, we're outside the pattern
process($extracted_lines) if $extracted_lines;
$extracted_lines = '';
}
}
sub process
{
# do stuff with the extracted lines
# maybe performing more regex's
}
>>> Morgan <[EMAIL PROTECTED]> 06/19/01 01:12pm >>>
Hi
I'm newbee perl developer and a rookie of xml :(
Is there anyone who can give me some hints or help me out with a problem
I have?
Here is the problem.
I will recive newsarticles three times a day in xml format and I need to
automaticly publish those articels on a web page, on the first page it
should only show the tags down to </INL>
tag and a link to the whole page.
Here is a sample of the xml format.
<ART>
<ORD>anbud</ORD>
<LEV>2001-06-14</LEV>
<DAT>14-06-01</DAT>
<PUB>DAGENS INDUSTRI</PUB>
<RUB>Dragkamp om förlusttåg</RUB>
<INL>Here is the indroduction about the article and when the word
anbud comes up it is enclosed in <HIT>anbud</HIT> tags.
This is the word we use as criteria on the articels we should recive.
</INL>
<BRO>
Here comes the rest of the document, thats the whole article.
The article ends with
</BRO>
</ART>
Raven
This e-mail and any files transmitted with it are confidential
and solely for the use of the intended recipient.
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715.