in reply to Getting Weekly Dates

See Date::Calc, for starters.

UPDATE:

I cooked up a solution that would work for my personal file naming convention.

Consider a directory full of files like: summary.interfaces.yyyymmdd
I could run the following code, and simply grep this directory for all files ending in "$period".
#!/usr/local/bin/perl -w use strict; #Usage: $0 <yyyy> <1 2 3> #period 1,2,3, that is die "Usage: $0 <yyyy> <1 2 3>, #period 1,2,3, that is\n" unless @ARGV +==2; my $prepend = $ARGV[0]; my $per = $ARGV[1]; my @period; my @files; if ($per eq 1) { @period = ("$prepend"."0101", "$prepend"."0630"); } elsif ($per eq 2) { @period = ("$prepend"."0701", "$prepend"."0831"); } elsif ($per eq 3) { @period = ("$prepend"."0901", "$prepend"."1231"); } else {die "Usage: $0 <yyyy> <1 2 3>, #period 1,2,3, that is\n";} foreach my $element(@period) { print "$element\n"; } my $from = $period[0]; my $to = $period[1]; while ( $from < $to ) { print "$from\n"; } continue { $from++; }
Certainly not the prettiest, but it would work for me.

HTH,

Steve

update again:corrected typo

Replies are listed 'Best First'.
Re: Re: Getting Weekly Dates
by mothra (Hermit) on Mar 09, 2001 at 01:34 UTC
    Good try, but the year is not constant. :)