Unicode scalar count: $length() and the expression-length limit are defined in scalars, never UTF-16 code units. Iteration yields code points, so a surrogate pair counts once and a lone surrogate counts as the one scalar it is.
$length()
Unicode scalar count:
$length()and the expression-length limit are defined in scalars, never UTF-16 code units. Iteration yields code points, so a surrogate pair counts once and a lone surrogate counts as the one scalar it is.