Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

"Unrecognized character" while use utf8 is in effect

by AppleFritter (Vicar)
on Apr 17, 2015 at 10:03 UTC ( [id://1123740]=perlquestion: print w/replies, xml ) Need Help??

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 1123740.pl 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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1123740]
Approved by hippo
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found