http://www.perlmonks.org?node_id=63961


in reply to Counting number of characters in a string

y cccc or (for 1 char shorter than length), y!!!c.

japhy -- Perl and Regex Hacker