use Quantum::Superpositions;
my @set = (1, 2, 3, 4, 5);
print "3 is a member!\n" if 3 == any(@set);
print "8 is a member!\n" if 8 == any(@set);
Admittedly, this isn't the fastest solution (see the responses above for those), but it maps well to how I like to think about set operations. Sacrificing speed for clarity. :)
-Bird |