|There's more than one way to do things|
Re^4: Trying to determine the output length of a Unicode stringby ikegami (Pope)
|on Sep 26, 2011 at 19:37 UTC||Need Help??|
Then you should find his comments about Text::Wrap as they are pertinent here. Maybe it was on the Perl5 Porters mailing list (which is archived).
Most people will say the same about Perl, map, etc, but that's a stupid reason not to use Perl, map, etc. Especially where performance matters, which is likely for this function.
What I used: ()= returns the length of the list returned by the expression that follows (when used in scalar context).
How it works: List assignmemt in scalar context returns the number of elements to which the RHS evaluated.
It's actually very straightforward. There's nothing hidden, it uses well known idioms, and it require only the lowest mental load (only need to remember one value at a time).
Really? I use list assignment in scalar context countless times a day. More often than the match operator, I dare say.
Your implication that someone needs to read the docs for that, but not for \X and capture-less m/.../g is unconvincing.