in reply to Re: Date::Calc::Iterator
in thread Date::Calc::Iterator

Hi,

Is there any other way to carry out this in Perl w/out using this module? I got it printing out the values correctly thanks to both your replies. But now I realized I can't specify the date range values.

For example if I altered the code like this, it makes an error:
use Date::Calc::Iterator; # This puts all the dates from Dec 1, 2003 to Dec 10, 2003 in @dates +1 # @dates1 will contain ([2003,12,1],[2003,12,2] ... [2003,12,10]) ; my $sr = "2005,07,1"; my $i1 = Date::Calc::Iterator->new(from => [$sr], to => [2005,10,1]) + ; my @dates1 ; push @dates1,$_ while $_ = $i1->next ; foreach my $v (@dates1) { print "@$v<br>"; }
Since I used the scalar inside the from brackets, it prints an error saying this: Invalid start date at C:/Perl/site/lib/Date/Calc/Iterator.pm line 25.

Thank you lots, Erold

Replies are listed 'Best First'.
Re^3: Date::Calc::Iterator
by Samy_rio (Vicar) on Jul 14, 2005 at 07:44 UTC

    You cannot asign a scalar value as a input for that object and also not posible to convert the string to an array by giving "[ ]" symbols. But you can give array as a input as shown below:

    use Date::Calc::Iterator; # This puts all the dates from Dec 1, 2003 to Dec 10, 2003 in @dates +1 # @dates1 will contain ([2003,12,1],[2003,12,2] ... [2003,12,10]) ; my @sr = (2005,07,1); my $i1 = Date::Calc::Iterator->new(from => [@sr], to => [2005,10,1]) +; my @dates1 ; push @dates1, $_ while $_ = $i1->next ; foreach my $v (@dates1) { print "@$v\n"; }

    Regards,
    Velusamy R.