AppleFritter has asked for the wisdom of the Perl Monks concerning the following question:

Oh monks most tawny and tangy, whose wisdom and knowledge of all things Perl is unalienable and indefeasible, help me out, for I'm very much missing the obvious.

As you will well know, Perl allows Unicode characters in variable names, so long as use utf8; is in effect. So the following snippet works as expected (apologies for the unresolved HTML entities, Perlmonks itself does not handle Unicode properly):

my $人 = "World"; say "Hello, $人";

However, the following does not:

my $&#1F310; = "World"; say "Hello, $&#1F310;";

Perl 5.20.0 complains about this, saying:

Unrecognized character \x{1f310}; marked by <-- HERE after my $<-- + HERE near column 5 at line 9.

This is even though the character is in Unicode 6.3.0, which Perl 5.20.0 supports.

So why isn't it working? Help me out, fellow monks.

Replies are listed 'Best First'.
Re: "Unrecognized character" while use utf8 is in effect (perldata/Variable names)
by Anonymous Monk on Apr 17, 2015 at 10:07 UTC

      Aha! I knew there was something obvious I was missing.

      (And this should teach me to read the documentation carefully, because when I first glanced over it I'd thought that "Names that do not start with a letter, underscore, digit or a caret (i.e. a control character) are limited to one character" meant I should be good.)

      Thank you, brother. I have been enlightened.

Re: "Unrecognized character" while use utf8 is in effect
by vinoth.ree (Monsignor) on Apr 17, 2015 at 10:32 UTC

    Perl identifiers must consist of word characters alphanumerics and underscore. "a" and "b cd" are word characters. "dollar sign" and "euro sign" are not.

    All is well. I learn by answering your questions...