How do I get $len as 1 in this example?
Works for me:
$ cat lig.t use strict; use warnings; use utf8; use Test::More tests => 1; my $char = "ffi"; my $len = length($char); is ($len, 1); $ perl lig.t 1..1 ok 1 $ perl -v This is perl 5, version 20, subversion 3 (v5.20.3) built for x86_64-linux-thread-multi (with 16 registered patches, see perl -V for more detail)
If you are working with these sorts of characters you could do a lot worse than go through the length() miscounting UTF8 characters? thread.
In reply to Re: Counting text with ligatures
by hippo
in thread Counting text with ligatures
by albert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |