Re: if statement



Also sprach A. Sinan Unur:
> "Chris H" <socialism001@xxxxxxxxx> wrote in
> news:1130456186.193121.312170@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

>> $newline2 =
>> join(',','code9',$ENV{'REMOTE_HOST'},$now_string,$ENV{'REMOTE_ADDR'},
>> $query->param('email'),$query->param('distribution'),
>> $query->param('-max'),$query->param('-min'),$query->param('~=use'),
>> $query->param('~=city'))
>> ;
>
> Are you trying to make your code hard to read on purpose?
>
> my $newline2 = join(',',
> 'code9',
> $ENV{'REMOTE_HOST'},
> $now_string,
> $ENV{'REMOTE_ADDR'},
> $query->param('email'),
> $query->param('distribution'),
> $query->param('-max'),
> $query->param('-min'),
> $query->param('~=use'),
> $query->param('~=city')
> );

Come one, you can do better than that. ;-) The six calls to param() are
a job for a type-writing monkey. Or map:

my $newline2 = join ',',
'code9',
$ENV{REMOTE_HOST},
$now_string,
$ENV{REMOTE_ADDR},
map $query->param($_),
qw/email distribution -max -min ~=use ~=city/;

> Note that IMHO $query is not a great name for the CGI object (even
> thought the docs use it). I prefer to use $cgi.

And it even saves two unnecessary keystrokes.

Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
.