in reply to
Trimming a mailbox
As thargas dramatically pointed out, parsing the date externally is risky, and should be unnecessary. Are you sure it is faster? How did you benchmark or profile it?
Instead there are are a number of modules on CPAN for the purpose. I have had most success with HTTP::Date, and there is also Date::Parse
Another approach you could use would be to switch your mailbox to use maildir format, and then each email is in a different file and the date on each file will match the received date, so a simple find invocation will remove old file.