compound conditional statement driving me nuts
[email protected] (Lee Collings) Tue, 17 Jun 2003 17:18:24 -0700
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <[email protected]> |
I'm wondering if anyone can solve this riddle for me.
I am trying to compare a couple of dates using the following
if (($start_pub_year ge $yr && $end_pub_year le $yr) &&
($start_pub_mon ge $mo && $end_pub_mon le $mo) &&
($start_pub_day ge $day && $end_pub_day le $day))
{
Print "it is a valid date"
}
Print "it isn't a valid date"
but nothing I try works. I've used, &, &&, and all to no avail.
Where is what I'm trying to do "in english"
If todays year is greater than the beginning publish year and less
than the ending publish year
and
If todays month is greater than the beginning publish month and less
than the ending publish month
and
If todays day is greater than the beginning publish day and less than
the ending publish day
Show me the valid date message
else
Show me the invalid message
You can see an example of this failing at:
http://www.foothill.edu/cgi/newscenter.cal.cgi
If I just test for the year, it works. But when I try to add the tests
for they month and day, it fails.
Any takers?
TIA,
Lee Collings