title: How to process a string char by char in the XS code
body: <p>Let's suppose there is a piece of code like this:</p>
  
  <pre><code>  my $str = 'some text';
    my $result = my_subroutine($str);
  </code></pre>
  
  <p>and <code>my_subroutine()</code> should be implemented as Perl XS code. For example it could return the sum of bytes of the (unicode) string.  </p>
  
  <p>In the XS code, how to process a string <strong>(a)</strong> char by char, as a general method, and <strong>(b)</strong> byte by byte, if the string is composed of ASCII codes subset (a built-in function to convert from the native data srtucture of a <em>string</em> to char[]) ?</p>