@@ -284,7 +284,7 @@ The angle brackets quoting is like C<qw>, but with extra feature that lets you
284
284
construct L < allomorphs|/language/glossary#index-entry-Allomorph > or literals
285
285
of certain numbers:
286
286
287
- say <42 4/2 1e6 1+1i abc>.perl ;
287
+ say <42 4/2 1e6 1+1i abc>.raku ;
288
288
# OUTPUT: «(IntStr.new(42, "42"), RatStr.new(2.0, "4/2"), NumStr.new(1000000e0, "1e6"), ComplexStr.new(<1+1i>, "1+1i"), "abc")»
289
289
290
290
To construct a L « C < Rat > |/type/Rat» or L « C < Complex > |/type/Complex» literal, use
@@ -351,21 +351,21 @@ Note that variable interpolation happens before word splitting:
351
351
The C < qqw > form of word quoting will treat quote characters literally,
352
352
leaving them in the resulting words:
353
353
354
- my $a = 42; say qqw{"$a b" c}.perl ; # OUTPUT: «("\"42", "b\"", "c")»
354
+ my $a = 42; say qqw{"$a b" c}.raku ; # OUTPUT: «("\"42", "b\"", "c")»
355
355
356
356
Thus, if you wish to preserve quoted sub-strings as single items in the
357
357
resulting words you need to use the C < qqww > variant:
358
358
359
- my $a = 42; say qqww{"$a b" c}.perl ; # OUTPUT: «("42 b", "c")»
359
+ my $a = 42; say qqww{"$a b" c}.raku ; # OUTPUT: «("42 b", "c")»
360
360
361
361
Quote protection happens before interpolation, and interpolation happens
362
362
before word splitting, so quotes coming from inside interpolated variables are
363
363
just literal quote characters:
364
364
365
365
my $a = "1 2";
366
- say qqww{"$a" $a}.perl ; # OUTPUT: «("1 2", "1", "2")»
366
+ say qqww{"$a" $a}.raku ; # OUTPUT: «("1 2", "1", "2")»
367
367
my $b = "1 \"2 3\"";
368
- say qqww{"$b" $b}.perl ; # OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")»
368
+ say qqww{"$b" $b}.raku ; # OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")»
369
369
370
370
= head2 X <<< Word quoting with interpolation and quote protection: « »|quote,<< >>;quote,« » >>>
371
371
@@ -375,12 +375,12 @@ functionally equivalent to L<qq:ww:v|#index-entry-:val_(quoting_adverb)>). The
375
375
ASCII equivalent to C < « » > are double angle brackets C « << >> » .
376
376
377
377
# Allomorph Construction
378
- my $a = 42; say « $a b c ».perl ; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
379
- my $a = 42; say << $a b c >>.perl ; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
378
+ my $a = 42; say « $a b c ».raku ; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
379
+ my $a = 42; say << $a b c >>.raku ; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
380
380
381
381
# Quote Protection
382
- my $a = 42; say « "$a b" c ».perl ; # OUTPUT: «("42 b", "c")»
383
- my $a = 42; say << "$a b" c >>.perl ; # OUTPUT: «("42 b", "c")»
382
+ my $a = 42; say « "$a b" c ».raku ; # OUTPUT: «("42 b", "c")»
383
+ my $a = 42; say << "$a b" c >>.raku ; # OUTPUT: «("42 b", "c")»
384
384
385
385
= head2 X < Shell quoting: qx|quote,qx >
386
386
0 commit comments