I don't quite understand what is failing, but since I'd never used Date::Calc before, I wrote a little skip_WeekEnd() routine for you.
Hope it helps...Add one line to include Friday->Monday.

Calculate the date that you need in one sub.
Do the formatting in another sub or inline if it becomes simple enough.
Your "length($month)" sort of stuff is confusing (at least to me) and there are problems with using a string operator like length() with something that is designed to operate on integer values.

#!/usr/bin/perl -w use strict; use Date::Calc qw(Day_of_Week Date_to_Text_Long Add_Delta_YMD); use Data::Dumper; my @dates = ([2012, 8, 9 ], # Thursday DOW=4 [2012, 8, 10], # Friday DOW=5 [2012, 8, 11], # Saturday DOW=6 [2012, 8, 12], # Sunday DOW=7 [2012, 8, 13]);# Monday DOW=1 foreach my $dateRef (@dates) { print "Current Date: ",Date_to_Text_Long(@$dateRef),"\n"; my @NoWeekend = skip_WeekEnd(@$dateRef); print "Skip Sat/Sun: ",Date_to_Text_Long(@NoWeekend),"\n\n"; } sub skip_WeekEnd #returns next Monday if this is a Weekend { my @date = @_; my $dow = Day_of_Week(@date); @date = Add_Delta_YMD(@date,0,0,2) if($dow == 6);#Sat @date = Add_Delta_YMD(@date,0,0,1) if($dow == 7);#Sun return @date; } __END__ Current Date: Thursday, August 9th 2012 Skip Sat/Sun: Thursday, August 9th 2012 Current Date: Friday, August 10th 2012 Skip Sat/Sun: Friday, August 10th 2012 Current Date: Saturday, August 11th 2012 Skip Sat/Sun: Monday, August 13th 2012 Current Date: Sunday, August 12th 2012 Skip Sat/Sun: Monday, August 13th 2012 Current Date: Monday, August 13th 2012 Skip Sat/Sun: Monday, August 13th 2012

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

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.