my $s = Set::Scalar->new (@lst); if ($s->contains ($i)) { ... }