tilly gives: 1600 chetlin gives: 1600 Benchmark: running chetlin, tilly, each for at least 5 CPU seconds... chetlin: 9 wallclock secs ( 5.52 usr + 0.00 sys = 5.52 CPU) @ 333.70/s (n=1842) tilly: 10 wallclock secs ( 5.09 usr + 0.00 sys = 5.09 CPU) @ 104.52/s (n=532) #### my @patterns=qw/foo bar baz blarch/; my $tilly=qr/(@{[join "|",@patterns]})/; my @chetlin=map qr/$_/,@patterns; my $target="foo baz blarcy foo blarch"x400; sub tilly { my $count; $count++ while ($target =~ /$tilly/g); print STDERR "tilly gives: $count\n" if ((caller)[1]!~/eval/); } sub chetlin { my $count; for (@chetlin) {$count++ while ($target =~ /$_/g) } print STDERR "chetlin gives: $count\n" if ((caller)[1]!~/eval/); } tilly(); chetlin(); use Benchmark; timethese(-5, { tilly => \&tilly, chetlin => \&chetlin, });