What i'm after is a shorter way to test whether any of those variables == 1.
If by shorter you mean "golfed down", i.e. achieving the same with less characters typed - it is up to you to be smart, go ahead, be clever.. but if by shorter you mean less convoluted, I'd propose to wrap the test into a loop which aliases each var, more so if there's a variable amount of many variables to test, and it is possible to wrap them into an array (which should be possible but in very weird cases):
$test_succeeded = 0; for(@vars_to_test) { 1 == $_ and ++$test_succeeded and last; } if ($test_succeeded) { ... }
In reply to Re: Testing multiple variables against the same criteria (IF statement)
by shmem
in thread Testing multiple variables against the same criteria (IF statement)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |