good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Date Range Parsingby boo_radley (Parson) |
on Feb 15, 2001 at 21:23 UTC ( [id://58656]=note: print w/replies, xml ) | Need Help?? |
Of course it returns 100 days; your while loop simply increments through the $date counter -- there's never any logic to treat $date like a date. I would suggest using Date::Calc to verify that $date is really a valid date, and I'm sure there's TIMTOWTDI. here's a sample I whomped up off the top of my head: Note that there's a lot of improvement to be wrung from this -- the regexp to split the date and the concatenation to reform it could be removed by using just $this_year and $this_month and $this_day, but this might require some other adjustments to your code. update : There's a function in Date::Calc called Add_Delta_YMD which does pretty much the same thing.
In Section
Seekers of Perl Wisdom
|
|