method to get a get a hash of the messages (the hash keys) and their unique identifiers (the hash values). Create a list in a file or DB table to store these unique ID. Each time you run your script have it get the ID's from the server and then compare these to those in your saved list. Foreach message ID that is not already in your save list, push it onto an array (@get_these). Now loop though this array and use the
method to pull only those you haven't already. After they messages have been retrieved (or in the same foreach loop) write them to your save list. You can read more about Net::Pop3