title: I think this code finds string length. What's actually going on here?
body: <p>I've been tasked with converting some code from Perl to Python, and I ran into this bit of code that confused me:</p>
  
  <pre><code>my $length = map $_, $root =~ /(.)/gs;
  </code></pre>
  
  <p>From the variable names and testing, I've determined it gets the length of a string, but it seems like a really bizarre and unreadable way to do it. Is there any reason why someone might use that instead of <code>length($root)</code> or the horrible <code>$root =~ y///c</code>, as mentioned in <a href="https://stackoverflow.com/questions/223393/how-do-i-get-the-length-of-a-string-in-perl">this post</a>? I want to make sure I'm not missing some functionality based on some strange Perl behavior that I don't know about.</p>