# @substrings is currently up to over 10,000 entries # string is given anything up to 20 times a second, and needs to be checked as it comes through as quickly as possible @substrings = ('apple','orange','pear','cumquat','peach'); $string = "really long string which may or may not contain \$substring anywhere"; foreach $substring ( @substrings ) { if ( $substring ~= $string ) { print "Match found\n"; last; } }