I wouldn't roll my own mbox parser. I would use a CPAN module or if I HAD to, hack
OpenWebmail's mbox parsing to do my evil bidding. Parsing mbox is supposed to be fairly simple, but in my experience there are so many wierd variances that I've had much better success using well maintained parsers that are mature.