On 14 Dec 1999 15:54:40 PST, Nicholas G. Thornton wrote: >in the test part of an if statement is there a way to simplify... > if ($value == $a or $value == $b or $value == $c or $value == $d or ...) >...into... > if ($value == ($a or $b or $c or $d or...)) >...or something similar? I can't seem to find it in the Camel book. Funny that none of the replies so far mention hashes. For numerical tests, this may not be ideal, but for string tests, it clearly is. if($value eq $a or $value eq $b or $value eq $c or $value eq $d ...)) { is equivalent to: %test = map { $_ => 1 } ($a, $b, $c, $d); if($test{$value}) { You may separate hash initialization from the test, e.g. if you do the test in a loop, move the hash initialization to outside the loop. -- Bart. # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org