OUTER: { foreach my $animal (@animals) { last OUTER if $str !~ /$animal/; } print "Matched all of them!"; }