in reply to Testing multiple variables against the same criteria (IF statement)

You could do:

if( grep{ $_ == 1 } $var1, $var2, $var3, $var4 ) {

But that won't short-circuit -- ie. It will test all 4 variables every time -- and is really only beneficial if the vars are an array.

You might consider List::MoreUtils::any() which will short-circuit.

Personally, if there are only four variables and using an array doesn't work for you; I'd stick with your original statement.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.