in reply to Parsing a Pine mailbox

It seems to me that parsing into individual emails won't really buy you anything. A simple parse is best. Here I illustrate the idea for id, path and size:
my %rec; my $pid; while (<>) { $pid = $1 if /^Backup ID: (\d+)$/; $rec{$pid}{path} = $1 if /^Path: (\S+)$/; $rec{$pid}{size} = $1 if /^Size: (\d+)$/; }
Because the attributes always come after the primary id, little bookkeeping is required to populate a hash, or a database. It isn't clear to me how the subject enters the problem, so I left that out.

-Mark

Replies are listed 'Best First'.
Re: Re: Parsing a Pine mailbox
by tdp05 (Acolyte) on May 06, 2004 at 18:00 UTC
    yea, I guess you're right. I think anything in the subject will be displayed in the body of the message, and I'll be able to grab it from there.

    I didn't think to look at the most basic way to do it. I figured I'd have to look at something much more complex.

    I'll probably give this a shot and see how it goes.