if ((my $x=grep {/ABC|GHI|MNO/}@FILES) == 3){ print qq|Found them all\n| }else{ print qq|found only $x\n| }