Here's one way:
     my @woo;
     my $xml;
     foreach (@woo) { $xml .= $_, if (m/\<\?xml\s/.../\<\/Order/); }

You could also set the upper and lower bounds with scalars:
     my $upper = '\<\?xml\s';
     my $lower = '\<\/Order';
     foreach (@woo) { $xml .= $_, if (m/^$upper/.../^$lower/);

jab

On Fri, 21 Feb 2003, Vincent O' Keeffe wrote:

> Date: Fri, 21 Feb 2003 14:16:11 -0000
> From: Vincent O' Keeffe <[EMAIL PROTECTED]>
> Reply-To: Vincent O' Keeffe <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RegExp and XML
>
> Hi there,
>
> I'm downloading xml files from a mail server using POP3Client. I'm saving these 
>mails as files on a directory. I also parse out certain details from the XML file to 
>include in the filename.
>
> The only problem is that, when I grab the body of the message using POP3Client's 
>method, it includes mail-related information above and below the actual XML tags.
>
> ------=_Part_15_1895070.1044374870502
> Content-Type: text/plain
> Content-Transfer-Encoding: 7bit
>
> <?xml version="1.0"?>
> ...
>
> </Order>
> ------=_Part_15_1895070.1044374870502--
>
>
> So, I need to remove everything before the opening <?xml string and, again, 
>everything after the closing </Order> tag. I thought about stripping out the first 4 
>and last 4 lines of the file but the messages sometimes arrive clean, and sometimes 
>with this extra info.
>
> I've trawled newsgroups and the web and haven't been able to come up with any 
>answers.
>
> Does anyone have any idea of how to go about this if I assign the body to a variable 
>like so?
>
> $msgbody = $pop->Body($i)   # $pop being the instantiated POP connection object
>
> Thanks,
> Vincent
>

--------
Be straight and to the point. Don't waste others' time.
Do your homework before you ask for help.

--Unknown


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

Reply via email to