This is probably a case of unnecessary optimization, but here are benchmark results for those interested:
s/iter join dot interpolate1 interpolate
+2
join 2.22 -- -24% -25% -32
+%
dot 1.69 31% -- -1% -11
+%
interpolate1 1.67 33% 1% -- -10
+%
interpolate2 1.50 48% 13% 12% -
+-
And here's the code that generated this. I had to loop a bunch to get any kind of result. Not sure if this has any kind of effect on anything.
use strict;
use warnings;
use Benchmark qw/:all/;
my $string;
my ($var1, $var2, $var3) = ('asdf', 'zxcv', 'qwer');
cmpthese(4, {
dot => sub {
$string = $var1 . $var2 . $var3 for (0 .. 10000000);
},
interpolate1 => sub {
$string = "${var1}${var2}${var3}" for (0 .. 10000000);
},
interpolate2 => sub {
$string = "$var1$var2$var3" for (0 .. 10000000);
},
join => sub {
$string = join('', $var1, $var2, $var3) for (0 .. 10000000);
},
});