if( grep { $_ eq $test } ( $item1, $item2 ) ) {
#..... This was an "or"
}
if( grep { $_ eq $test } ( $item1, $item2 ) == 2 ) {
#..... This was an "and"
}
####
use List::MoreUtils qw/ any all /;
#Here is an "or" condition.
if( any { $_ == 1 } ( 1, 2, 3 ) ) {
print "True.\n";
# This one is true because one of the elements matched.
}
#Here is an "and" condition.
if( all { $_ == 1 } ( 1, 2, 3 ) ) {
print "True.\n";
# This one is NOT true, because only one of the three elements matched.
}
##
##
use Quantum::Superpositions;
if( any( 1, 2, 3 ) == 1 ) {
print "True.\n";
}
if( all( 1, 2, 3 ) == 1 ) {
print "True.\n";
# This one fails because only one, not all elements matched.
}