in reply to if else statement check an array
If I understand correctly, what you want to get is a result of FAIL if any of the test in the loop fails.
So, you can set to a true value (1) a variable before the loop and reset to false (0) whenever a single test fails. At the end of the loop the var has the value you expected.
my $result = 1; foreach my $issued_CM_commands (@issued_commands){ my $showconfig; $result = 0 if index("@showconfig", "$issued_CM_commands") == 0 } print "\n--",$result ? 'PASS' : 'FAIL',"\n";
(Untested)
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
|
|---|