develooper Front page | perl.macperl.webcgi | Postings from June 2003

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

Thread Previous | Thread Next
From:
Jeff Lowrey
Date:
June 18, 2003 05:49
Subject:
Re: [MacPerl-WebCGI] compound conditional statement driving me nuts
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About