in reply to Re: Comparing array contents to DB contents
in thread Comparing array contents to DB contents

Or, slower (no short-circuit) but shorter:

foreach $row (@{$list}) { my @matching = map { String::Approx::amatch($row->[$_+1],$vals[$_]) ? $_ : () } (0..$#vals); return (@matching==@vals) ? $row[0]; } # none found; do the insert, get the new id and return it

(no check for undef columns here either...)