http://www.perlmonks.org?node_id=1066167


in reply to [Solved] What are these hex character classes?

From Prelre:

\x{}, \x00 character whose ordinal is the given hexadecimal number

The \x denotes the beginning of a hexadecimal value.

Also see: Unicode character table.

Replies are listed 'Best First'.
Re^2: What are these hex character classes?
by three18ti (Monk) on Dec 08, 2013 at 01:35 UTC
    This is great. Thank you!

    So like most things in computing, the zeros are omitted, so \x{A} is actually \x{000A}.

      You're most welcome, three18ti!

      Perl expectedly parses both as "\n" (the leading zeros aren't significant):

      perl -MO=Deparse,-p -e 'print "\x{A}"'

      Output:

      print("\n"); -e syntax OK

      And:

      use warnings; use strict; print ord "\x{A}" if "\x{000A}" eq "\n";

      Output:

      10

      As you see, \x{A}, \x{000A} and \n all represent the same character.