http://www.perlmonks.org?node_id=1007935

kitkit201 has asked for the wisdom of the Perl Monks concerning the following question:

I want to do some conditional checks with respect to hostname and the following status history hash as shown below.. $host is the input variable . I want the IF condition to either check if the host is a red-type-alert, or and orange-type-alert with the first two status_history to be 1,1 or any other alert with status_history be 1,1,1 Here's what I have now..
@redAlert = ( "db" ); @orangeAlert = ("c", "sm" ); 'status_history' => { 'status' => [ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ], if ( ( $redAlert =~ $host ) || ( $orangeAlert =~ $host && $status_his +tory =~ /1,1/) || ( $status_history =~ /1,1,1/ ) )
Would that work? Thanks kit