Your benchmark may be relatively fair, but your use of qr is bad. qr is used to compile a regex, so you are compiling a regex on every iteration of your loops. You could assign something like my $re = qr{test}; before the benchmark and then use /$re/ in the benchmark, but I think it would be better to just use /test/ inside the benchmark code, that way you're not measuring things that you don't mean to measure.