Do you have use strict; and use warnings; enabled? Can you confirm that the report file is actually being written out?

It isn't as simple as you having the system line that does the mailing commented out, can it? Note that it's missing its closing single-quote, but that doesn't matter... $d won't interpolate within single-quotes, so change them into double-quotes.

Also try closing the file before sending the mail: close F or die $!;. You should also avoid using bareword file handles, and use the three-arg open: open my $wfh, '>', "Report_$d.txt" or die $!;, then replace the file handle F with $wfh. Here's an example using a "heredoc" to eliminate the numerous prints:

my $report = <<EOF; Here is the Results from the Script ------------------------------------- $PrStat ------------------------------------- $Mail ------------------------------------- $Iface EOF open my $wfh, '>', "Report_$d.txt" or die $!; print $wfh $report; close $wfh or die $!; print "This script has finished!\n\n" . "Generating Email!\n\n"; system ("mail test@server.com < Report_$d.txt");

In reply to Re: Email Question by stevieb
in thread Email Question by btobin0

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.