#!/usr/bin/perl use strict; use warnings; use Encode; binmode(STDOUT, ":utf8"); print "\x{7a7a}\x{624b}\n"; print codepoint_hex("空") . " " . codepoint_hex("手") . "\n"; sub codepoint_hex { return sprintf "%4x", ord Encode::decode("UTF-8", shift); }