SPUG: Date::Manip infinite loop

Joel Grow joel at largest.org
Sat Jan 12 14:36:35 PST 2013


Hello SPUG gurus,

I'm stumped as to why the code below gets into an infinite loop on 
November 4, 2012.  I tried starting $current_date at Jan 1, 2011, and it 
gets into an infinite loop on November 6, 2011. This is on a linux box 
running perl 5.10.1.  When I run it on another linux box running 5.8.8, 
it works fine. Any idea what's going on? Thanks!

-J


use strict;
use Date::Manip;

my $current_date = '2012/01/01';

while (Date_Cmp($current_date, '2012/12/31')) {
   print "Current date is: $current_date\n";
   $current_date = UnixDate(DateCalc($current_date, "+1 days"),
                     "%Y/%m/%d");
}

print "Bye!\n";



More information about the spug-list mailing list