Home  |  Linux  | Mysql  | PHP  | XML
From:Jeff Lowrey Date:Wed Jun 18 06:49:20 2003
Subject:Re: [MacPerl-WebCGI] compound conditional statement driving me nuts
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
Navigate in group perl.macperl.webcgi at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants