Great advice, and I've printed the script out to look it over and pick out the code I have so far to place in subroutines.

As of now, I have changed some of the code to execute almost the entire code in a subroutine &ipod;, which I have set to match no matter what in a if/else statement (It runs the logger in both cases).

if ($from =~ /address|address2/ig) { if ($to =~ /address|address2/ig) { if ($textstuff =~ /sent from my ipod/ig || $textstuff =~ /sent from my + iphone/ig) { print "From ME----\nSubject: $subject\nFrom: $from\nTo: $to\nDate: $da +te\nContent Type: content\nMime Type: $mime\nEffective Type: $effecti +ve\n"; &ipod; } else { if ($textstuff !~ /sent from my ipod/ig || $textstuff !~ /sent from my + iphone/ig) { print "----NOT ipod ----\nSubject: $subject\nFrom: $from\nTo: $to\nDat +e: $date\nContent Type: content\nMime Type: $mime\nEffective Type: $e +ffective\n"; &ipod; }

It's ugly, but it gets the job done mostly. Unfortunately, it still suffers from only running through and prints only one instance of 'from ME' or '----NOT ipod' and then no longer prints any messages, other than the statement that it's moving files. Also, it never reaches the bottom statement to extract files using attachment:stripper, which is somewhat confusing.

I would imagine that it's a problem with the foreach statement only executing once due to the fact that it stops printing, but since it executes all the other code (opens the log file, prints to it, executes the moving of files), I just have to try to track down where the problem is happening as well as why it's not executing the attachment stripper section of code.

Thanks again for the reply, and once I can track down why the above is happening, I plan to redo it into subroutines (as well as all future scripts). :-)


In reply to Re^2: Perl MIME parser partially works with my code I wrote (code does not exist , there is no code) by CalebH
in thread Perl MIME parser partially works by CalebH

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.