in reply to Getting Weekly Dates
Certainly not the prettiest, but it would work for me.#!/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++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Getting Weekly Dates
by mothra (Hermit) on Mar 09, 2001 at 01:34 UTC |