title: How to truncate a string to a specific length in perl?
body: <p>I am just unable to find "truncate a string to a specific length" in Perl.
  Is there any built in way?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>input:  <code>$str = "abcd";</code></p>
  
  <p>output (truncate for 3 characters): $str is <code>abc</code></p>