in reply to Date::Calc::Iterator

Use Data::Dumper Module.

print Dumper(@dates1);

Replies are listed 'Best First'.
Re^2: Date::Calc::Iterator
by rev_1318 (Chaplain) on Jul 14, 2005 at 08:16 UTC
    Why would you want to use Data::Dumper? The problem of the OP is very obvious and a simple statement about Data::Dumper without explanation doesn't add anything to the understanding of the problem (which is: $v is a array reference and should be dereferenced via @$v).

    Paul

Re^2: Date::Calc::Iterator
by Anonymous Monk on Jul 14, 2005 at 07:04 UTC
    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

      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.