Re: [MacPerl-WebCGI] compound conditional statement driving me nuts

[email protected] (Jeff Lowrey) Wed, 18 Jun 2003 07:49:20 -0500
Newsgroups perl.macperl.webcgi
Message-ID <p05200f00bb160f6e4438@[192.168.136.25]>
At 5:18 PM -0700 6/17/03, Lee Collings wrote:
>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))

'&&' is probably the wrong operator here.  Use 'and' instead

if 	(($start_pub_year ge $yr and $end_pub_year le $yr) and
	 ($start_pub_mon ge $mo and $end_pub_mon le $mo) and
	 ($start_pub_day ge $day and $end_pub_day le $day))

I don't remember whether 'ge' is the right choice instead of '>=' 
either.  I wouldn't use it myself, but that doesn't mean it's wrong.

And as Christian Huldt said, you need to make sure you know what 
you're comparing.

-Jeff Lowrey