In addition to what Masem said, use strict, and unless you want an array slice, access anonymous arrays like this:
$MsgCount->[$count];
But in fact I would drop the $count altogether. Rather than do an infinite loop in which you increment and test $count (sort of like a hand-rolled C-style for loop) just loop over the array:
foreach my $MsgLine (@$MsgContent) { ... }
which is going to be faster and gives more hints to the person reading the code about what your intent is. This may mean moving actions you now have on the final iteration of the loop outside of it. That is another stylistic change I would approve of. Things in the loop are things you expect to do on each iteration. Things outside are not.

Remember that debugging is largely an exercise in guessing where the code does not do what the programmer intended. Therefore subtle (and not so subtle) clues about your intent will help in debugging and maintainance.

If you expect to have only 2 elements in a split, then use the third argument to split.

I would rethink the scope of some of your variables. If they are private, they should be declared in a tight scope. If they are global, I would prefer to see them declared with vars. If they are per message (which they appear to be) then perhaps a hash would make more sense.

And one bug alert. Microsoft a long time ago put into all of their tools the ability to recognize the end of a header by the fact that you have seen all required fields, making the return superfluous for them. About a year ago IIRC they then dropped the return separating header from body from Outlook 2000. The result was an upgrade which worked fine for anyone running Outlook, but would cause all sorts of fun for people using other email programs.

The hope, of course, was that people would blame their own email programs for crashing since others got their email and it worked just fine. I won't say it didn't work. But I will say that this is the kind of dirty pool that makes me despise Microsoft. No, I don't appreciate their making other people's lives harder for reasons that I don't agree with. But the fact is that they do, and you need to be aware of it.

So I recommend finding someone with Outlook 2000 (I believe that that is the one that mangled the standard) and getting them to send you sample messages so you can analyze their dirty pool and waste time and energy you shouldn't have had to working around their crap...


In reply to Re (tilly) 1: Evaluation of Simple Pop3 Client by tilly
in thread Evaluation of Simple Pop3 Client by Jamnet

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.