in reply to Using Sendmail - how can I active use defined variables in the Message Body

Can you point me to the line(s) in the script you posted that is/are producing this output?

Next expected eMails from MCP (local Time): Server Start: $NEXTDAY, around 10:00

I don't see "$NEXTDAY" anywhere in the code you posted, nor do I see the text, "eMails from MCP". Maybe it's some neat obfu trick, but otherwise, I don't really want to spend time looking at code that isn't capable of producing the output you're describing.


Dave

  • Comment on Re: Using Sendmail - how can I active use defined variables in the Message Body
  • Download Code

Replies are listed 'Best First'.
Re^2: Using Sendmail - how can I active use defined variables in the Message Body
by CoffeeDuke (Initiate) on Aug 13, 2012 at 09:47 UTC
    $nextday is calculated in line 44. if you do a print on that it should give you the date. $mon is done in line 55. sorry my bad about the print out text I changed it in the code after I wrote it. Its the part in line 71 / 72
    print (SM "Master Server:" .$nextday, "around 10:00am <BR><BR>"); print (SM "Backup Server:" .$mon, "around 10:30am <BR><BR>");
    Thanks for answering Dave, much appriciated.

      Unrelated to the output you're receiving, but this line can never be false:

      if (Day_of_Week($year, $month, $day) || "1,2,3,4") {

      Also, these two lines are a little perplexing:

      $nextday = $day1.$month.$year; $nextday = (length($day1) < 2) ? "0".$day1."." :$day1;

      The second assignment clobbers the first one... may as well just get rid of the first one.

      At any rate, can you post the exact code that's failing, and the exact copied and pasted output? I still don't think we've seen code, and output from the same version of your script.


      Dave

      $NEXTDAY is NOT the same variable as $nextday. The following example uses strings as the values in the variables, but using numeric values (with appropriate adjustment of the test at Ln 8) would provide a similar demonstration.

      #!/usr/bin/perl use 5.014; # 987079 my $NEXTDAY = "fooday"; my $nextday = "BARDAY"; if ($NEXTDAY eq $nextday) { say "Behold, a miracle!"; } else { say "\$NEXTDAY is $NEXTDAY and \$nextday is $nextday"; }

      If you used the == test at Ln 8, you would observe an apparent miracle... but only because an == test checks for numeric equality... even when applied to non-numerics (eg, strings).