#Search strings that must much - ARRAY form. my @arrayOfSearchStrings = map { "[$_]" } 945850 .. 945852; my %searchStrings = map { $_ => 1 } @arrayOfSearchStrings; OUTER: for (@dataArray) { for my $pat (keys %searchStrings) { if (/\Q$pat/) { delete $searchStrings{$pat}; last OUTER unless %searchStrings; } } } if (%searchStrings) { print "Did not find all needed search strings\n"; } else { print "Found ALL SEARCH STRINGS required in ARRAY\n"; }