in reply to How to count string length with latin characters?

If you expect your input to be utf8, use utf8; then and length will return the number of characters (not bytes) that string is composed of.

If your input is to be in non-utf8 yet not in plain ASCII, you should use encoding 'wanted_encoding, length will work in "character" semantics as well. See encoding for more.

If you want to know the number of bytes that string is composed of, or your input is in plain ASCII, you can force perl to work like this by use bytes;. See bytes for more.