日付がある範囲内か調べる
Date::RangeとDate::Simpleを使うと簡単です。
use strict; use Date::Simple; use Date::Range; my $day1 = Date::Simple->new('2000-10-10'); my $day2 = Date::Simple->new('2010-12-12'); my @days = qw( 2000-10-01 2000-10-10 2000-10-20 2010-12-10 2010-12-20 ); my $range = Date::Range->new($day1, $day2); print "start: ", $range->start, "\n"; print "end : ", $range->end, "\n"; print "days : ", $range->length, "\n"; print "-----\n"; foreach my $day (@days) { my $date = Date::Simple->new($day); print "$day "; if ($range->includes($date)) { print "o"; } else { print "x"; } print "\n"; }