Gossamer Forum
Home : General : Perl Programming :

Re: quite an easy question i believe?

Quote Reply
Re: quite an easy question i believe? In reply to
Your logic is off, you're telling the interpreter to set
$price1 = 7, only if:
Code:
"The $price is less than 4,000", and "The $price is more
than 40,000". It will never be both, it can only be one or
the other. You are saying that it has to be both.
Here's your original code:
In Reply To:
elsif (($price < 4000) && ($price > 40000 ) && ($agent2 eq "ok")) {
$price1 =7;
}
Just change it to something like the following:
Code:
elsif (($price > 4000) && ($price < 40000 ) && ($agent2 eq "ok")) {
$price1 =7;
}
I think that will accomplish what you wanted. But, what
happens if the price is exactly 4,000 or 40,000? In those
cases, the $price1 variable will NOT be set to 7. To do
that, just add an equal sign (=) after the less than (<) or
greater than (>) symbol that you want.

For example to set $price1=7 when the $price is between
4,000 and 40,000, or exactly 4,000, then you would do this:

Code:
elsif (($price >= 4000) && ($price < 40000 ) && ($agent2 eq "ok")) {
$price1 =7;
}
And the same if you wanted it set when the price was at 40,000, like this: $price <= 40000

Hope that helps,

-Steven

Subject Author Views Date
Thread quite an easy question i believe? intermarkets 3633 Jun 8, 2001, 1:49 AM
Thread Re: quite an easy question i believe?
Andy 3552 Jun 8, 2001, 2:15 AM
Post Re: quite an easy question i believe?
intermarkets 3525 Jun 8, 2001, 2:31 AM
Post Re: quite an easy question i believe?
Andy 3521 Jun 8, 2001, 3:19 AM
Post Re: quite an easy question i believe?
shetland 3516 Jun 8, 2001, 3:58 AM