The simple example below shows the basic steps in order to check the list of messages in a mailbox using pop3 and Net::POP3 with Perl
use Net::POP3;
# Create a new POP3 object
my $pop3 = Net::POP3->new($ServerName, Debug => 1);
# Get the list of messages
my $Messages = $pop3->list();