LanX has asked for the wisdom of the Perl Monks concerning the following question:
please help me understand either
from perlop#Quote-and-Quote-like-Operators
\x{263A} [1,8] hex char (example shown: SMILEY) \x{ 263A } Same, but shows optional blanks inside and adjoining the braces
DB<55> p join ",",map {ord} split //, "\x{ 41 }" + 0 + DB<56> p join ",",map {ord} split //, "\x{41}" + 65 + DB<57> p join ",",map {ord} split //, "\x{263A}" + 9786 + DB<58> p join ",",map {ord} split //, "\x{ 263A }" + 0 + DB<59> p "\x{41}" + A + DB<60> p "\x{ 41 }" + ^@
tested with strawberry perl 5.032001 on win
Question: In which way is this
"Same, but shows optional blanks inside and adjoining the braces" ?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) OK - ironically - reading the footnotes help
https://perldoc.perl.org/perlop#%5B1%5D
[1] The result is the character specified by the hexadecimal number between the braces. See "8" below for details on which character.
Blanks (tab or space characters) may separate the number from either or both of the braces.
Otherwise, only hexadecimal digits are valid between the braces. If an invalid character is encountered, a warning will be issued and the invalid character and all subsequent characters (valid or invalid) within the braces will be discarded.
If there are no valid digits between the braces, the generated character is the NULL character (\x{00}). However, an explicit empty brace (\x{}) will not cause a warning (currently).
and activating warnings shows the bug, somehow the blank is not recognized.
DB<65> use warnings; "\x{ 263A }" + Non-hex character ' ' terminates \x early. Resolved as "\x{00}" at (e +val
different warnings by version ... this is getting weirder and weirder
C:\tmp>%PERL% -w print $]; print "\x{ 41 }"; Illegal hexadecimal digit ' ' ignored at - line 2. __END__ 5.024001
C:\tmp>%PERL_532% -w print $]; print "\x{ 41 }"; Non-hex character ' ' terminates \x early. Resolved as "\x{00}" at - +line 2. __END__ 5.032001
|
|---|