The
Mail::MboxParser
module offers a nice interface to achieve this.
MIME::Parser is one of the most robust mail parsing moudles that you may also want to consider, but it has a steep learning curve in my opinion.
Update As
valdez points out you will need something like Mail::POP3Client to get the mails, I misread your post and thought for some strange reason you already had the messages locally.