use Benchmark qw/cmpthese/; my $append = 'B' x 50; cmpthese (100, { dot => sub { my $c = 'A' x 50; $c = $c . $append for 1..1e5; }, dot_eq => sub { my $c = 'A' x 50; $c .= $append for 1..1e5; }, substr => sub { my $c = 'A' x 50; substr $c, length $c, 0, $append for 1..1e5; }, }); __END__ Rate substr dot dot_eq substr 16.5/s -- -35% -37% dot 25.5/s 55% -- -2% dot_eq 26.0/s 58% 2% -- #### use Benchmark qw/cmpthese/; my $append = 'B' x 256; cmpthese (100, { dot => sub { my $c = 'A' x 50; $c = $c . $append for 1..1e5; }, dot_eq => sub { my $c = 'A' x 50; $c .= $append for 1..1e5; }, substr => sub { my $c = 'A' x 50; substr $c, length $c, 0, $append for 1..1e5; }, }); __END__ Rate substr dot_eq dot substr 6.99/s -- -35% -49% dot_eq 10.7/s 53% -- -21% dot 13.6/s 95% 27% --