in reply to convert scalar to wide hexadecimal value? how?

\x{010C} is only a equal to Č if it appears in a string literal. Otherwise, you may want to use 'chr'. Two ways of converting "<U+010C>":
$text =~ s/<U\+([0-9A-Fa-f]+)>/qq!"\\x{$1}"!/ee; $text =~ s/<U\+([0-9A-Fa-f]+)>/chr hex $1/e;

Replies are listed 'Best First'.
Re^2: convert scalar to wide hexadecimal value? how?
by merlinX (Novice) on Jan 14, 2009 at 12:11 UTC
    Indeed, thanks ... regex is not my strong point anyway, so hence a little additional question, suppose I have multiple <U+xxxx> codes in the string like for instance  "TEST <U+010C> <U+0158> <U+0147>"... how does the regexp look like then?
      Just found it ... I guess I have to add the g of global right?
      $text =~ s/<U\+([0-9A-Fa-f]+)>/qq!"\\x{$1}"!/gee;
        Indeed.