Sorry, we tend not to give out ready-made scripts around here, this is a site to help people who want to program in perl, not to provide complete solutions. So the most advice you're likely to get is, try using
Super Search to see if we already have such a thing, try looking at the finished scripts provided on
CPAN to see if theres any there you could use.
Barring that, you'll have to find one that more or less does what you want, try to change it to fit your needs, and then ask here if you get stuck.
BTW: Theres a module (or two), for doing POP3 with perl, eg Net::Pop3, which makes pop3 very easy.
C.