A few other suggestions for you:

1) Replace the opening constants with actual constants

i.e: $MAX_MAILS=200;
becomes
use constant MAX_MAILS => 200;

2) A fairly minor optimisation but consider replacing all double quoted strings with single quotes whereever possible

i.e.
$temp_pic= $BASEURL . "/" .
becomes
$temp_pic = BASEURL . '/' (using constants as well :P)

3) s/\s\t\r\n+//i
Does this really need to be case insensitive - you are not matching any characters only classes of whitespace. Check all your regexes as this is an unecessary slowdown (I think :P).

4)Finally, consider using slurp mode for opening any files.
i.e.(not tested code so watch out!)
open(FH,"<$file"); my $data; { local $/ = undef; $data = <FH>; # Slurrp } close(FH);
I would also consider putting all your sub routines into a module and create what I would term a functionality object. You can then use something like 'autouse' and have a routine for each phase of the program. You don't need to split it up then. You could also consider embedding this via mod_perl and preloading the object within Apache (assuming an apache + mod_perl host)

Hope that helps! Contact me if you need any more help :)

Simon

In reply to Re: A few ideas for an old script by simon.proctor
in thread A few ideas for an old script by panamasnet

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.