Perl loop through days code

Here is some code for looping through days
http://datetime.perl.org/index.cgi?FAQSampleCalculations
http://datetime.perl.org/index.cgi?FAQBasicUsage

#!/bin/env perl
use DateTime;
my $start_dt = DateTime->new(year => 2009, month => 4, day => 27);
my $end_dt = DateTime->new(year => 2009, month => 5, day => 18);

my $weeks = 0;
for (my $dt = $start_dt->clone();
$dt <= $end_dt;
$dt->add(days => 1) ) {
print $dt->date('')."\n";
$weeks++;
}

Comments

Popular posts from this blog

Vim vi how to reload a file your editing