in reply to Re^2: If conditional checks
in thread If conditional checks
You can use grep instead of the smart match operator (~~):
grep /^$host$/, @redAlert
or ( grep /^$host$/, @orangeAlert and $statusHist01 == 2 )
or $statusHistTot == 3
print "We've got a winner!";
grep iterates through all array elements, and in scalar context (as in this case), it returns the number of times an expression is true. Each expression in the greps is a regex that requires an exact match between the value of $host and an array element (contained in the default scalar, $_) to be evaluated as true.