Hello everyone, I have a subroutine below that uses Date::Manip to build a hash with keys of the previous Wednesday to the next Tuesday range from the beginning of the year until today. For instance:
%pairs = ( #didn't want to list the whole year, but you get the point '10/15/2003' => '10/21/2003', '10/22/2003' => '10/28/2003', ); Here's my subroutine: sub wedToTues() { my ($day, $month, $year) = (localtime)[3,4,5]; $year += 1900; $month++; my $beginyear = &ParseDate("$year/01/01"); my $today = &ParseDate("today"); my $firsttues = &ParseDate("$year/01/07"); my $endyear = &ParseDate("$year/12/31"); #print "$beginyear $endyear\n"; #Build an array of every Tuesday in the current year my @dates = &ParseRecur("0:0:1*2:0:0:0",$firsttues,$beginyear,$today); use Tie::IxHash; tie my %pairs, "Tie::IxHash"; foreach my $date (@dates) { my $lastWed = &DateCalc("$date","- 6 days"); #my $ulastWed = &UnixDate($lastWed, "%Y%m%d"); #my $udate = &UnixDate($date, "%Y%m%d"); my $ulastWed = &UnixDate($lastWed, "%m/%d/%Y"); my $udate = &UnixDate($date, "%m/%d/%Y"); $pairs{$ulastWed} = $udate; } return \%pairs; } Yes, I understand that to adjust the variables that I pass to ParseRecur, but I'm not sure how to go about doing what I need. I'll try to explain as best as I can. First, I'll be changing this subroutine to be Saturdays to Fridays rather than Wednesdays to Tuesdays. Then based on the day it's run, I need to only get the previous 3 weeks and the next 4 weeks. Basically I'd like a hash (or whatever) that looks like this: %datepairs = ( # Saturday to Following Friday '10/11/2003' => '10/17/2003', '10/18/2003' => '10/24/2003', '10/25/2003' => '10/31/2003', '11/01/2003' => '11/07/2003', '11/08/2003' => '11/14/2003', '11/15/2003' => '11/21/2003', '11/22/2003' => '11/28/2003', ); Can anyone offer suggestions or a more graceful way of doing this? Thanks, Kevin -- Kevin Old <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]