Literals & quoting

Unicode escapes

Full

Write any character by codepoint (\x[…]) or by its Unicode name (\c[…]).

Inside a double-quoted string you can name any character two ways: \x[…] by hexadecimal codepoint, and \c[…] by its official Unicode name. Both produce the actual character.

By codepoint — \x[…] #

say "\x[41]\x[42]";
say "\x[3B1]";
Output
AB
α

\x[41] is A (U+0041); \x[3B1] is α (U+03B1).

By name — \c[…] #

\c[NAME] inserts the character with that Unicode name — self-documenting for characters you can't easily type.

say "\c[LATIN SMALL LETTER E WITH ACUTE]";
Output
é

Notes #