title: How do I reduce a variable's length to 20 characters in Perl?
body: <p>Basically I have some very long variables and need only the first few characters.</p>
  
  <p>I tried using this regex, but it doesn't work.</p>
  
  <pre><code>$var =~ s/(^.{20})?/$1/g;
  </code></pre>
  
  <p>It doesn't do anything to it.</p>
  
  <p>Any help would be appreciated.</p>