Benchmark: timing 500000 iterations of chromatic, chromatic2, lookbehind... chromatic: 18 wallclock secs (18.83 usr + 0.01 sys = 18.84 CPU) @ 26543.50/s chromatic2: 13 wallclock secs (13.55 usr + 0.00 sys = 13.55 CPU) @ 36900.37/s lookbehind: 14 wallclock secs (14.95 usr + 0.00 sys = 14.95 CPU) @ 33442.58/s #### use Benchmark; use vars qw/$a $b $c/; ($a, $b, $c) = qw/bar baz foo/; timethese(shift || 500000, { lookbehind => sub { local $_ = "foobarquux"; s/(?<=$c)$a/$b/g }, chromatic => sub { local $_ = "foobarquux"; s/($c)$a/$1$b/g }, chromatic2 => sub { local $_ = "foobarquux"; s/$c$a/$c$b/g }, });