Thank you for your comments. I will be the first to admit my Perl is really rusty since I have moved from a system admin role to primarily PHP web development. But on with the comments. I have taken some of you comments to heart and implemented them including (corresponding numbers to your comments):
0)use warnings;
1)Proper use of localtime and sprintf
3)Fixing the sql statements
4)Making store boolean rather than string
My comments on your other suggestions follow:
2)The reason I am using the while statement rather than just using exists is because I have found the address that I pull out of the email can be the pure email address (test@test.com) or the email address with a name ("TEST USER" <test@test.com>). Using the while statement allows me to use an approximate match.
3)I am not using the more simplified selectrow_array that you suggested because there could be many addresses to filter and so those need to be stored in an array
4)Although I using boolean rather than string I have kept the foreach in there fore the same reason as number 2 above. I need to do an approximate match rather than an exact match.

I think part of the problem you are having in diagnosing is an incomplete description on my part. We are setting up a forwarding server where people can have an email address on our domain that forwards to their own personal email address. What we are hoping is people that have ocntacts around the world will sign up and allow us to harvest the body of their email to look at linguistic problems so as a result the setup is this. Each email address in our domain will forward to one personal email address and according to the user's contacts and what they submit to us each email will be stripped and stored for further linguistic analysis. I hope that clears it up more.

In reply to Re^4: Mail:Audit Resend Problem by tertullian01
in thread Mail:Audit Resend Problem by tertullian01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.