Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: stream parsing an mbox file

by repson (Chaplain)
on Apr 12, 2001 at 15:11 UTC ( #72015=note: print w/ replies, xml ) Need Help??

in reply to stream parsing an mbox file

To repeat the behaviour of your code I'd do:

my @mails; while (<>) { if (/^From /) { $mails[$#mails + 1] = $_; } else { $mails[$#mails] .= $_; } }
It seems to me from previous experimentation that any lines in the body text starting with 'From ' will already be quoted with a > character, so that they will not cause the test I used to pass and will not therefore create a new array element.

Comment on Re: stream parsing an mbox file
Download Code
Replies are listed 'Best First'.
Re: Re: stream parsing an mbox file
by johnfoobar (Initiate) on Apr 12, 2001 at 15:25 UTC
    that's exactly what i was looking for.

    took me a while to spot the ".=" in the else, i thought it was an "=" for a while. :)

    PS, how did you see this post? i can't see it at The Monastery Gates, or in SOPW.. i had to do a search to see my own post. i must be doing something wrong.

      Check the Newest Nodes

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://72015]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2016-02-13 17:57 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (442 votes), past polls