This script aims to integrate an icon in a taskbar or something like. It is based on the libnet module. If you don't own it already, installing it should be not a big deal as it's available on almost every distribution. For the Gentoo users, just type in:

emerge dev-perl/libnet

Making it work requires a configuration file in your home directory ~/.secret_pop3. Put 3 lines in this file:

server pop3.my_server.com
login my_username
passwd my_password

And the script:

#!/usr/bin/perl
use strict;
use Net::POP3;
use Env qw(HOME);
open(POP3FILE, $HOME . "/.secret_pop3") or print "file!" and exit;
my $var; my $varVal; my %allVar;
while (<POP3FILE>) {
 chomp;
 ($var,$varVal) = split(/ /);
 $allVar{$var} = $varVal;
}
my $pop = Net::POP3->new($allVar{server}, Timeout=>5) or print "net!" and exit;
$pop->apop($allVar{login}, $allVar{passwd}) or print "account!" and exit;
my ($undeleted) = $pop->popstat;

print $undeleted;
$pop->quit