# perl 5.10.0: timethis 10: 0 wallclock secs ( 0.33 usr + 0.00 sys = 0.33 CPU) @ 30.30/s (n=10) (warning: too few iterations for a reliable count) # perl 5.8.8: timethis 10: 79 wallclock secs (78.92 usr + 0.04 sys = 78.96 CPU) @ 0.13/s (n=10) #### use strict; use warnings; my @alphabet = ('a'..'z', 'A'..'Z', ' '); sub random_string { my $length = int shift; return join '', map { @alphabet[int rand(@alphabet)] } 1..$length; } my $re = join '|', map { random_string(5+rand(10)) } 1..500; my $target = random_string(1e2); use Benchmark qw(timethis); timethis(100_000, sub { $target =~ m/$re/ })