use Encode; open my $FH, '<:raw', $utf8file; read $FH, my $data, -s $FH; print length decode("utf8",$data);