Since this seems to be a one-off project, the success of which can more or less be determined by hand, if this code works for you then fine. In general, I'd say you should use one of the many Mbox-handling modules on CPAN (Mail::MboxParser, Mail::Mbox::MessageParser or the 800-pound gorilla of all mailbox-handling modules Mail::Box). There are some corner cases which your code does not cover but these modules will help you avoid, for example, your above code adds addresses included in the From: lines of forwarded messages to your own address book, which may not be what you want. Similar thing for the email addresses, use Email::Address and you won't have to worry about stuff like commas in the quoted section of the name preceding an email address. And if you want to see what a complete email-parsing regular expression looks like then run
perl -MEmail::Address -e 'print $Email::Address::mailbox'In reply to Re: Reconstructing a Thunderbird address book from an mbox file
by tirwhan
in thread Reconstructing a Thunderbird address book from an mbox file
by missingthepoint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |