tags:

views:

55

answers:

2

I'm using Date::Manip http://search.cpan.org/~sbeck/Date-Manip-6.11/lib/Date/Manip.pod for a variety of things, and want to create an array of days of the month. I think I need:

@date = &ParseRecur("2010:4:0:0:0:0:0"); 

but, it doesn't do it. I've read & reread the man page but can't get the syntax.

@date = &ParseRecur("2010:4:0:1:0:0:0"); 
@date = &ParseRecur("2010:4:0:1*:0:0:0"); 

don't work either!

+1  A: 

You could build the list with your own loop, instead of using ParseRecur.

$month = 4;
for ($day = 1; $day <= 31; $day++) {
    my $date = UnixDate( "$month/$day/2010", "%m-%d-%Y" );
    push( @list, $date ) if (defined $date);
}
Robert Wohlfarth
+2  A: 

From the man pages: "There are a small handful of English strings which can be parsed in place of a numerical recur description." Check out the examples in the man page.

So, if you want an array of days of a month - say for June in 2010 you would do:

@dates = ParseRecur("every day in June 2010");
Bart J