in reply to Testing multiple variables against the same criteria (IF statement)
Hi Anonymous,
You could have a look at the modules Quantum::Superpositions (I love the name ;-)) or Perl6::Junction:
use Quantum::Superpositions 'any'; # - or - #use Perl6::Junction 'any'; my ($var1,$var2,$var3,$var4) = (0,0,0,0); if ( any($var1,$var2,$var3,$var4) == 1 ) { print "Bingo!\n"; }
Of course, if you have variables named $var1,$var2,...,$varN, you really should be using arrays...
my @ary = (0,0,0,0); if ( any(@ary) == 1 ) { print "Bingo2!\n"; }
Hope this helps,
-- Hauke D
|
|---|