@@ -310,7 +310,7 @@ Note that variable interpolation happens before word splitting:
310
310
my @list = qqw{$a c};
311
311
.say for @list; # OUTPUT: «abc»
312
312
313
- = head2 X <<< Word quoting with interpolation and quote protection: qqww|quote,qqww;quote,<< >>;quote,« » >>>
313
+ = head2 X <<< Word quoting with interpolation and quote protection: qqww|quote,qqww; >>>
314
314
315
315
The C < qqw > form of word quoting will treat quote characters literally, leaving them in the
316
316
resulting words:
@@ -322,11 +322,6 @@ you need to use the C<qqww> variant:
322
322
323
323
my $a = 42; say qqww{"$a b" c}.perl; # OUTPUT: «("42 b", "c")»
324
324
325
- or equivalently:
326
-
327
- my $a = 42; say <<"$a b" c>>.perl; # OUTPUT: «("42 b", "c")»
328
- my $a = 42; say «"$a b" c».perl; # OUTPUT: «("42 b", "c")»
329
-
330
325
Quote protection happens before interpolation, and interpolation happens before word splitting,
331
326
so quotes coming from inside interpolated variables are just literal quote characters:
332
327
@@ -335,6 +330,20 @@ so quotes coming from inside interpolated variables are just literal quote chara
335
330
my $b = "1 \"2 3\"";
336
331
say qqww{"$b" $b}.perl; # OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")»
337
332
333
+ = head2 X <<< Word quoting with interpolation and quote protection: « »|quote,<< >>;quote,« » >>>
334
+
335
+ This style of quoting is like C < qqww > , but with an extra feature that lets you construct
336
+ L < allomorphs|/language/glossary#index-entry-Allomorph > . The ASCII equivalent to C < « » > are
337
+ double angle brackets C « << >> » .
338
+
339
+ # Allomorph Construction
340
+ my $a = 42; say « $a b c ».perl; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
341
+ my $a = 42; say << $a b c >>.perl; # OUTPUT: «(IntStr.new(42, "42"), "b", "c")»
342
+
343
+ # Quote Protection
344
+ my $a = 42; say « "$a b" c ».perl; # OUTPUT: «("42 b", "c")»
345
+ my $a = 42; say << "$a b" c >>.perl; # OUTPUT: «("42 b", "c")»
346
+
338
347
= head2 X < Shell quoting: qx|quote,qx >
339
348
340
349
To run a string as an external program, not only is it possible to pass the
0 commit comments