I am having trouble setting up my date variable.
%day2t = qw( Friday T Saturday T-1 Sunday T-2 Monday T-3 Tuesday T-4 Wednesday T-5 Thursday T-6 ); $tday = $day2t {"$day"};
So I already have some code to determine what day it is and once I know the current day, I set my $tDay variable depending on that.
My next step is to to take this $tDay variable and and subtract that amount from the current date. So, if $tDay contains "t-4", I need to subtract that from today's date.

For example, Today is Monday. So $tDay variable will be set to "T-3". Today's date is 25-Nov-2013. I need to be able to subtract 3 from 25 to get 22 as my final answer. I know how to do this but the part where I am having trouble is how to set 30 or 31 or 28 days for specific months. If current date is 4 and I have to subtract 5 from it, how do I handle that? Please help.

In reply to Setting up date to subtract specific number from it by vihar

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.