http://qs321.pair.com?node_id=950669


in reply to Re^2: If any element-in-array comparision
in thread If any element-in-array comparision


When using first as a condition, it's best to wrap it in a defined() to specifically check for the 'not found' case:
# this always works print "@a\n" if defined(List::Util::first { defined($_) && 0 == $_ } @ +a);

OTOH, I agree that first clobbers the predicate when checking for undef -- i.e. we can't tell if we found undef:
# doesn't work print "@a\n" if defined(List::Util::first { !defined($_) } @a);