in reply to Re: Parsing Pegasus email boxes
in thread Parsing Pegasus email boxes

So, if you are fairly confident about the character string that marks the end of each mail message in this file format, then the perl code that would step through a file one message at a time would be pretty simple:
{ open( IN, "pegasus.file" ) or die $!; local $/ = "\x1a"; # change the input record separator while (<IN>) # $_ now contains one whole message, { # up to and including \x1a # do what you want with the message # including, if you like: @lines = split /\n/; # work on lines # or you could strip off the pegasus header stuff # and treat the remainder as if it were vanilla email # (just like you'd get with common unix mail tools) } } # record separator now reverts back to default

Replies are listed 'Best First'.
Re: Re: Re: Parsing Pegasus email boxes
by peterr (Scribe) on Nov 17, 2003 at 03:15 UTC
    Hi,

    Thanks, that code worked okay. I think I now need to do some serious reading up on working with arrays and strings. :)

    Peter