There are a few common formats (for unixy mail programs - windows programs often use their own proprietary standards): mbox, maildir, and MH. You might take a look at
Mail::LocalDelivery. Or I think the Mail::Box solution suggested will do what you want (don't use Mail::Box myself).