#!/usr/bin/perl use strict; my @issued_commands = qw( ls rm df ); my @showconfig = qw( df ); my $check = @issued_commands; foreach my $issued_CM_commands (@issued_commands){ $check = (index("@showconfig", "$issued_CM_commands") > 0) ? $check : ++$check; } $check == @issued_commands ? print "Everything was in the array.\n" : print "Everything was not in the array.\n";
In reply to Re: if else statement check an array
by bichonfrise74
in thread if else statement check an array
by sqspat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |