in reply to Email Question

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");

Replies are listed 'Best First'.
Re^2: Email Question
by btobin0 (Acolyte) on Sep 24, 2015 at 20:26 UTC
    Now that strict and warnings are in place the $d is looking for an explicit package. How do I fix this?

      Why does it complain about $d but not about $PrStat ?

      See strict and my.

        Last Question.... Hopefully. close to the last line..
        system ('mail -s "Test" testmail@server.com, < DailyReport_$d.txt');
        I can send the email and I receive it but the subject does not show up. I have to me missing something simple.