Hi Monks!

I am working on a program that needs to print 45 days from the date given, I need to print the latest date first, can someone give me a hand on this one?!
Here is my code.

#!/perl/bin/perl use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use Date::Calc qw(Add_Delta_Days Day_of_Week); use strict; # DATE DROPDOWN (last 30 business days) common wherever found my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon++; $year += 1900; my (@date_dd_from,@date_dd_to); #Sample dates my $selected_date_from = "1/21/2008"; my $selected_date_to = "1/21/2008"; for (my $x = 1; $x < 45; $x++) # 45 days later { ($year,$mon,$mday) = Add_Delta_Days($year,$mon,$mday,1); my $dow = Day_of_Week($year,$mon,$mday); if (($dow != 6) && ($dow != 7)){ if ("$mon/$mday/$year" eq "$selected_date_from"){ push(@date_dd_from,"<option selected value=\"$mon/$mday/$yea +r\">$mon/$mday/$year</option>\n"); }else{ push(@date_dd_from,"<option value=\"$mon/$mday/$year\">$ +mon/$mday/$year</option>\n"); } if ("$mon/$mday/$year" eq $selected_date_to){ push(@date_dd_to,"<option selected value=\"$mon/$mday/$year\ +">$mon/$mday/$year</option>\n"); }else{ push(@date_dd_to,"<option value=\"$mon/$mday/$year\">$mo +n/$mday/$year</option>\n"); } } } print "\n@date_dd_to\n";


Thanks a lot!!!

In reply to Getting the Latest Date Issue by Anonymous Monk

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.