Hi, 

Could someone take a look at the code for me below and see if you can figure 
out what's wrong with it? I just want to evaluate $publish_date to see if it's 
with 21 days of the current date; if so then set $new_item=" True". Not sure 
why it's not doing that, I think the it's not evaluating the if statement. I do 
have Date::CalC installed. Thanks.  

"if (my ($year1,$month1,$day1) = Decode_Date_US($mmddyyy))". 


#!/usr/bin/perl
use strict;
use warnings;

sub NewProducts
  {

 use Time::localtime;
 use Time::Local;
 use Date::Calc qw(:all);

  # Create date property in format mmddyyyy
  # for input to Decode_Date_US() function below
  my $publish_date = "01/02/2009 12:32:03 PM";
  my $mmddyyyy = substr($publish_date, 5, 2);
  $mmddyyyy .= substr($publish_date, 8, 2);
  $mmddyyyy .= substr($publish_date, 0, 4);
        if (my ($year1,$month1,$day1) = Decode_Date_US($mmddyyyy))
                {
                my ($year2,$month2,$day2) = Today();
                my $delta = Delta_Days($year1, $month1, $day1, $year2, $month2, 
$day2);
                if($delta <= 21 && $delta >= 0)

                        {
                          my $new_item = "True";
                          
                        }
                
                }
   
  } #End of sub

&NewProducts();



      

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to