in reply to Improve my Code: Date List
my @mos = ('01', '02', '03', '04', '05', '06', '07', '08', '09', 10, 11, 12); ... my @thirtyone = ('01', '02', '03', '04', '05', '06', '07', '08', '09', 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
Leaving aside whether your approach is the right one, you could save yourself a lot of typing by learning about map and sprintf and by re-using what you have already built.
my @mos = map { sprintf q{%02d}, $_ } 1 .. 12; my @feb = ( @mos, 13 .. 28 ); my @leap = ( @feb, 29 ); my @thirty = ( @leap, 30 ); my @thirtyone = ( @thirty, 31 );
I hope this is of interest.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Improve my Code: Date List
by jwkrahn (Abbot) on Jun 18, 2009 at 23:16 UTC |