use strict; use warnings; my ($input, $str, @str, $t); $input .= chr(97 + int rand 26) for 1..100000; for (1..100000) { $str = ''; $str .= chr(97 + int rand 26) for 1..10; push @str, $str; } $t = time(); for (@str) { print "$_\n" if index($input, $str) != -1; } print time() - $t;