Re: if statement



Chris H <socialism001@xxxxxxxxx> wrote:

> I'm finding the following code gets executed regardless of the value of
^^^^^^^^^^^^^
> distribution:


We may be unable to help you if you present untruths to us...


> $query->param('distribution') == "Yes";


That is a _numeric_ equality test.

You should always enable warnings when developing Perl code, it
would have found your mistake for you!


> How should I have the If statement when using $query variables.

> if $query->param('distribution') {


You should have the if statement (not If statement, case matters)
in actual Perl syntax, which requires parenthesis around the condition:

if ($query->param('distribution')) {

Please don't waste the time of hundreds (thousands?) of people
around the world with non-Perl code, nor with problems easily
found by a machine.

Have you seen the Posting Guidelines that are posted here frequently?


--
Tad McClellan SGML consulting
tadmc@xxxxxxxxxxxxxx Perl programming
Fort Worth, Texas
.