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

$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.
  • Comment on Re^2: Using Sendmail - how can I active use defined variables in the Message Body
  • Download Code

Replies are listed 'Best First'.
Re^3: Using Sendmail - how can I active use defined variables in the Message Body
by davido (Cardinal) on Aug 13, 2012 at 10:01 UTC

    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

Re^3: Using Sendmail - how can I active use defined variables in the Message Body
by ww (Archbishop) on Aug 13, 2012 at 11:55 UTC

    $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).