johnfoobar has asked for the wisdom of the Perl Monks concerning the following question:
however i have to read the entire file into memory, and they're big (>30MB). i would like to process the file line-by-line to get the same @mails array, so i don't have to read the whole damn thing into a scalar. how should i go about doing this?{ local $/ = undef; $_ = <>; } my @mails = split /\nFrom .*\n/m;
i have a feeling i need to put the split in a loop, but i don't know where to begin. i'm a regexp newbie which doesn't help either.
(BTW i am aware of the Mail::Folder::Mbox and Mail::Box::Mbox modules on CPAN but they're overkill for what i want.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stream parsing an mbox file
by repson (Chaplain) on Apr 12, 2001 at 15:11 UTC | |
by johnfoobar (Initiate) on Apr 12, 2001 at 15:25 UTC | |
by jink (Scribe) on Apr 12, 2001 at 15:41 UTC | |
|
Re: stream parsing an mbox file
by physi (Friar) on Apr 12, 2001 at 15:02 UTC | |
by johnfoobar (Initiate) on Apr 12, 2001 at 15:33 UTC | |
|
Re: stream parsing an mbox file
by jink (Scribe) on Apr 12, 2001 at 15:02 UTC | |
|
Re: stream parsing an mbox file
by davorg (Chancellor) on Apr 12, 2001 at 15:59 UTC | |
|
Re: stream parsing an mbox file
by sierrathedog04 (Hermit) on Apr 12, 2001 at 23:40 UTC |