title: concatenating strings in Perl substitute expression
body: <p>I have a string having a repeating pattern, and I want to replace each occurrence of such pattern with another string. The replacement string is formed by concatenating a set of other strings. An example is as below. I first tried concatenating using the <code>.</code> operator as shown.</p>
  
  <p>But the output contained the dots themselves, so Perl does not treat it as an operator, but a literal <code>.</code>.</p>
  
  <pre><code>#!/usr/bin/perl
  use warnings;
  use strict;
  
  my $start = 'not-so-';
  my $end = '-but-a-little-bad';
  my $string = 'I am a good boy. Infact I am a very good boy';
  print "Before: $string\n";
  &gt;&gt;&gt;&gt; $string =~ s/(good)/$start.$1.$end/g;
  print "Later : $string\n";
  </code></pre>
  
  <p>So I removed the <code>.</code>s, and my statement became <code>$string =~ s/(good)/$start$1$end/g;</code>, and the output is as per expectation. But, I feel a statement like this might cause maintenance issues later.</p>
  
  <p>My question: Is there a better way of concatenating strings other than this? </p>