use Benchmark; my $qr_regex = qr/ab{1,}c{1,}/; my $str_regex = "ab{1,}c{1,}"; my $string = "asdabdabc"; timethese(10000000, { 'string' => sub { $string =~ /$str_regex/ }, 'string/o' => sub { $string =~ /$str_regex/o }, 'qr' => sub { $string =~ /$qr_regex/ }, });