I'm using 1..7 because Date::Manip returns 1 for the first day of the week, not 0. Yes, I loose the 0 index. That isn't a problem since I can very easily add or subtract 1 as needed to convert between Date::Manip and this code.
When I step through your code, which by the way, took some work for me since you are using much Perl mojo that I'm just not used to using, I am not getting the answer I expect.
If you start on Wednesday ($start_day = 2) and run to the third Friday ($days = 17), then you should have two Mondays, Tuesdays, Saturdays, and Sundays, and three Wednesdays, Thrusdays, and Fridays. I expect 2, 2, 3, 3, 3, 2, 2, but I get 2, 2, 3, 3, 3, 3, 2.
-Travis
In reply to Runrig's Solution RE: How Many Mondays in Date Range?
by THuG
in thread How Many Mondays in Date Range?
by THuG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |