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..
Would that work? Thanks kit@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/ ) )
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: If conditional checks
by Kenosis (Priest) on Dec 09, 2012 at 00:59 UTC | |
by kitkit201 (Initiate) on Dec 09, 2012 at 05:14 UTC | |
by tobyink (Canon) on Dec 09, 2012 at 11:06 UTC | |
by Kenosis (Priest) on Dec 09, 2012 at 05:45 UTC | |
by kitkit201 (Initiate) on Dec 12, 2012 at 20:13 UTC | |
by Kenosis (Priest) on Dec 12, 2012 at 21:46 UTC | |
| |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Back to
Seekers of Perl Wisdom