for my $element (@array) { next if ! exists $lookup{$element}; # Do the work here }