in reply to using grep to match more than two words
or..@arr1 = qw(Sun Moon Venus Pluto Neptune);
Secondly, to answer your question - here is one way to do it:@arr1 = ("Sun", "Moon", "Venus", "Pluto", "Neptune");
--Darrenif ((grep {$_ eq 'Sun'} @arr1) && (grep {$_ eq 'Moon'} @arr1)) { print "We have both a sun and a moon - yay!\n"; } else { print "Something is missing...\n"; }
|
|---|