jc23,
Ok - you look like you are well on your way. I have a few points:
  • my $recip = $recipient; is redundent. Just define $recipient as $recip at the top.
  • `rm $dirContent`; You should never use backticks in a void context. Use system if you are not concerned with capturing the output. In this case, I feel you should use neither. Perl has unlink.
  • I would recommend Perltidy for help in indenting/formatting.
  • A lot of your variables look to be used only once. If this is left over stuff, take the time to clean it up. It can help troubleshooting later.

    Finally - you still haven't described what process gets those messages to the files in the directory in the first place:

  • Is it a special Sendmail configuration?
  • Is it an alias that is actually a pipe to a script?
  • Is it something else?
    It is possible you could solve this problem earlier by putting in a fork: Write to this directory as well as forward a copy to a different recipient. This is probably the best thing to do anyway.

    Cheers - L~R


    In reply to Re: Re: Re: accessing mailbox files by Limbic~Region
    in thread accessing mailbox files by jc23

    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.