use warnings; use strict; use open qw/:std :utf8/; use HTML::Entities qw/decode_entities/; my $x = '리작'; my $xd = decode_entities($x); my $y = '\\xeb\\xa6\\xac\\xec\\x9e\\x91'; (my $yd = $y) =~ s/\\x([0-9a-f]{2})/chr hex $1/eig; utf8::decode($yd); print "$x =>$xd<=\n"; print "$y =>$yd<=\n"; if ( $xd eq $yd ) { print "Match!\n" } else { die "Mismatch!\n" }