Problems? Is your data what you think it is? | |
PerlMonks |
UTF-8 characters in variable names: some characters are not allowedby kikuchiyo (Hermit) |
on Sep 06, 2009 at 17:51 UTC ( [id://793800]=perlquestion: print w/replies, xml ) | Need Help?? |
kikuchiyo has asked for the wisdom of the Perl Monks concerning the following question:
According to the perlunicode manpage, use utf8 allows the use of unicode (UTF-8 encoded) characters in not only string literals, but identifier names. So I had the urge to try the following program: And it failed with this error message: This version, however, ran correctly: So it seems that while certain unicode characters can be in variable names, others cause an error. I wrote a little script to test which characters are supported. The results (omitted here) show that indeed, certain characters don't seem to be eligible as variable names. The question, then, is why? Of course, this is not much point in asking this, as using unicode in variable names is still a bad idea, according to many. Yet, a perl hacker should be able to use the euro sign (for example) as a variable name if he so chooses. (Test was run on a Windows XP with Camelbox Perl 5.10.0)
Back to
Seekers of Perl Wisdom
|
|