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


in reply to Re^7: Why should any one use/learn Perl 6?
in thread Why should any one use/learn Perl 6?

Thanks for the link. I didn't see anything in there about normalizing the source code in particular, but did try a test case with the 2018.05 version of Perl 6 with good results, in case anybody is interested:

$ cat t.p6 #!/usr/bin/env perl6 my $charé = "asdf"; if $charé { say "It Works!"; } $ perl6 t.p6 It Works!

The source:

$ grep \$char t.p6 | od -c 0000000 m y $ c h a r 303 251 = " a +s 0000020 d f " ; \n i f $ c h a r e 314 20 +1 0000040 { \n 0000043

After parsing:

$ perl6 --target=parse t.p6 | head | grep \$char | od -c 0000000 m y $ c h a r 303 251 = " a +s 0000020 d f " ; \n i f $ c h a r 303 251 0000040 { \n - E X P R : m +y 0000060 $ c h a r 303 251 = " a s d +f 0000100 " \n 0000102

Replies are listed 'Best First'.
Re^9: Why should any one use/learn Perl 6?
by liz (Monsignor) on Jun 12, 2018 at 14:05 UTC

    Thank you for trying!

    FWIW, there's nothing special about Perl 6 source code: when you run a script foo.pl, it's basically

    "foo.pl".IO.slurp.EVAL

    or if you're more procedurally inclined

    EVAL slurp "foo.pl"

    So the source code is handled exactly the same as any other source of text: assumed to be encoded in UTF-8 (by default) and thus normalized using synthetic graphemes if necessary. Also note that CRLF is such a synthetic grapheme

    say "\r\n".chars; # 1