#!/usr/bin/perl
use strict;
use feature qw{ say };
use warnings;
use Unicode::Normalize qw{ normalize };
use Unicode::GCString;
my $char = "\N{LATIN SMALL LETTER U WITH DIAERESIS}";
binmode *STDOUT, ':encoding(UTF-8)';
for (qw( D C )) {
my $n = normalize($_, $char);
my $gcs = 'Unicode::GCString'->new($n);
say join ' ', length($n),
$n =~ s/(\X)/$1/g,
$1,
$gcs->chars,
$gcs->columns,
$gcs->length;
}
2 1 ü 2 1 1
1 1 ü 1 1 1
Update: Added the output.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|