Skip to content

Commit

Permalink
.perl → .raku
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Feb 26, 2020
1 parent fcd6be3 commit 103c365
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions doc/Language/quoting.pod6
Expand Up @@ -284,7 +284,7 @@ The angle brackets quoting is like C<qw>, but with extra feature that lets you
construct L<allomorphs|/language/glossary#index-entry-Allomorph> or literals
of certain numbers:
say <42 4/2 1e6 1+1i abc>.perl;
say <42 4/2 1e6 1+1i abc>.raku;
# OUTPUT: «(IntStr.new(42, "42"), RatStr.new(2.0, "4/2"), NumStr.new(1000000e0, "1e6"), ComplexStr.new(<1+1i>, "1+1i"), "abc")␤»
To construct a L«C<Rat>|/type/Rat» or L«C<Complex>|/type/Complex» literal, use
Expand Down Expand Up @@ -351,21 +351,21 @@ Note that variable interpolation happens before word splitting:
The C<qqw> form of word quoting will treat quote characters literally,
leaving them in the resulting words:
my $a = 42; say qqw{"$a b" c}.perl; # OUTPUT: «("\"42", "b\"", "c")␤»
my $a = 42; say qqw{"$a b" c}.raku; # OUTPUT: «("\"42", "b\"", "c")␤»
Thus, if you wish to preserve quoted sub-strings as single items in the
resulting words you need to use the C<qqww> variant:
my $a = 42; say qqww{"$a b" c}.perl; # OUTPUT: «("42 b", "c")␤»
my $a = 42; say qqww{"$a b" c}.raku; # OUTPUT: «("42 b", "c")␤»
Quote protection happens before interpolation, and interpolation happens
before word splitting, so quotes coming from inside interpolated variables are
just literal quote characters:
my $a = "1 2";
say qqww{"$a" $a}.perl; # OUTPUT: «("1 2", "1", "2")␤»
say qqww{"$a" $a}.raku; # OUTPUT: «("1 2", "1", "2")␤»
my $b = "1 \"2 3\"";
say qqww{"$b" $b}.perl; # OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")␤»
say qqww{"$b" $b}.raku; # OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")␤»
=head2 X<<<Word quoting with interpolation and quote protection: « »|quote,<< >>;quote,« »>>>
Expand All @@ -375,12 +375,12 @@ functionally equivalent to L<qq:ww:v|#index-entry-:val_(quoting_adverb)>). The
ASCII equivalent to C<« »> are double angle brackets C«<< >>».
# Allomorph Construction
my $a = 42; say « $a b c ».perl; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")␤»
my $a = 42; say << $a b c >>.perl; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")␤»
my $a = 42; say « $a b c ».raku; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")␤»
my $a = 42; say << $a b c >>.raku; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")␤»
# Quote Protection
my $a = 42; say « "$a b" c ».perl; # OUTPUT: «("42 b", "c")␤»
my $a = 42; say << "$a b" c >>.perl; # OUTPUT: «("42 b", "c")␤»
my $a = 42; say « "$a b" c ».raku; # OUTPUT: «("42 b", "c")␤»
my $a = 42; say << "$a b" c >>.raku; # OUTPUT: «("42 b", "c")␤»
=head2 X<Shell quoting: qx|quote,qx>
Expand Down

0 comments on commit 103c365

Please sign in to comment.