# test.pl use strict; use warnings; binmode $_, ':encoding(UTF-8)' for *STDIN, *STDOUT, *STDERR; my $line = <>; print $line; chomp $line; print length($line), "\n"; __END__ # echo -e "\xe4\xbb\x96"|perl test.pl