Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
On Mon, 1 Oct 2001, Ross, Matt wrote:
> sorry,
> 09/31/1390
>
> -----Original Message-----
> From: Ross, Matt [mailto:EMAIL:PROTECTED]
> Sent: Monday, October 01, 2001 1:09 PM
> To: EMAIL:PROTECTED
> Subject: RE: [MLUG - DISCUSSION] 10/01/01
>
>
> 12/31/1321
OK, so here's the perl program that spits back all of the years that have
what I'll call a "palindate"; obviously, there can only be one such day
per year. :-) There are just 372 of these.
#!/usr/bin/perl -lw
foreach my $year (1..9999){ # no palindates for 5 digit years; no year 0
$_=sprintf("%04d",$year);
/^ # we match by digit pairs, starting with:
(
([0-1][123]) # 1) stuff that reverses to day of the month:
| # can't have 00 or anything reversing to
([1-9][0-2]) # over 31
)
# 2) stuff that reverses to the month means:
([1-9]0 # a) something must be there (no 00)
|
[0-2]1) # b) if not months 01-09, has to reverse to
# 10,11,12
$/x # 3) make sure we match only 4 digits, and
# /x means I can comment this regexp
&& print;
}
# jking
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/