or download this
use Benchmark;
print "holli\n";
...
timethis (999999, sub { $_ = "fox comes and fox goes into forest"; s/(
+?<=fox)(.+?)(fox)/$1the $2/; });
print "Roy Jonhson\n";
timethis (999999, sub { $_ = "fox comes and fox goes into forest"; s/(
+?=fox(?:(?!.*fox).)*forest)/the /; });