That works, thanks a lot for your help and suggestions guys! Awsome! Have a great weekend all!
--- On Fri, 3/6/09, Ryan Masters <rjmast...@gmail.com> wrote: From: Ryan Masters <rjmast...@gmail.com> Subject: Re: Date::CalC To: cybercruis...@yahoo.com Date: Friday, March 6, 2009, 5:28 PM Bobby, On Fri, Mar 6, 2009 at 5:45 PM, Bobby <cybercruis...@yahoo.com> wrote: > > Correction, $publish_date should equals = "03/02/2009 12:32:03 PM" not 01/02/2009. > > my $publish_date = "03/02/2009 12:32:03 PM"; > > Usually what I do is add print statements for each variable to verify it's value if I'm unsure. Another debugging tip is to add an else block to the conditional if statements. You are doing more work trying to use substr to pick out the values, and it's unnecessary to use Decode_Date_US. The assignment in a conditional if was actually failing, so your suspicion was correct. You should have trusted your gut. ;-) Best of luck and keep at it. Regards, Ryan Masters #!/usr/bin/perl use strict; use warnings; use Time::localtime; use Time::Local; use Date::Calc qw(:all); sub NewProducts { my $start_publish_date = "02/13/2009 12:32:03 PM"; my ($publish_date, $publish_time, $am_or_pm) = split ' ', $start_publish_date; # split on a space char my ($month1,$day1,$year1) = split '\/', $publish_date; # split on forward-slash, escaped by a backslash my ($year2,$month2,$day2) = Today(); my $delta = Delta_Days($year1, $month1, $day1, $year2, $month2, $day2); print "$delta days\n"; if($delta <= 21 && $delta >= 0) { my $new_item = "True"; print $new_item, "\n"; } else { print "FAIL\n"; } } #End of sub &NewProducts();