in reply to Re^3: Comparing multiple strings
in thread Comparing multiple strings
++hippo for the third TIMTOWTDI, which translates to if( all { $my1 ne $_ } 'EV-1891', 'EV-DKL1') { print "BAD"; last; }. Of these three, I would probably select unless( any { $my1 eq $_ } 'EV-1891', 'EV-DKL1') { print "BAD"; last; }, because the any can short-circuit faster; if the first one matches, it won't have to test all the others in the list: for the example list of two, that's irrelevant, but if there are dozens or hundreds or thousands to compare against, any would be faster than all ... ne or none ... eq
|
|---|