use Encode; my $code_points = encode('utf8', $x);