Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^8: Why should any one use/learn Perl 6?

by jeffenstein (Hermit)
on Jun 12, 2018 at 12:53 UTC ( [id://1216467]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1216467]
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: (7)
As of 2024-04-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found