@@ -655,7 +655,7 @@ L<hash|/routine/hash> routine instead:
655
655
The X < L < Array|/type/Array > constructor> returns an itemized L < Array|/type/Array > that does not flatten
656
656
in list context. Check this:
657
657
658
- say .perl for [3,2,[1,0]]; # OUTPUT: «32$[1, 0]»
658
+ say .raku for [3,2,[1,0]]; # OUTPUT: «32$[1, 0]»
659
659
660
660
This array is itemized, in the sense that every element constitutes an item, as
661
661
shown by the C < $ > preceding the last element of the array, the
@@ -681,10 +681,10 @@ Universal interface for positional access to zero or more elements of a
681
681
say @alphabet[*-1]; # OUTPUT: «z»
682
682
say @alphabet[100]:exists; # OUTPUT: «False»
683
683
say @alphabet[15, 4, 17, 11].join; # OUTPUT: «perl»
684
- say @alphabet[23 .. *].perl ; # OUTPUT: «("x", "y", "z")»
684
+ say @alphabet[23 .. *].raku ; # OUTPUT: «("x", "y", "z")»
685
685
686
686
@alphabet[1, 2] = "B", "C";
687
- say @alphabet[0..3].perl # OUTPUT: «("a", "B", "C", "d")»
687
+ say @alphabet[0..3].raku; # OUTPUT: «("a", "B", "C", "d")»
688
688
689
689
See L < Subscripts|/language/subscripts > , for a more detailed explanation of this
690
690
operator's behavior and for how to implement support for it in custom types.
@@ -699,7 +699,7 @@ Universal interface for associative access to zero or more elements of a
699
699
700
700
my %color = kiwi => "green", banana => "yellow", cherry => "red";
701
701
say %color{"banana"}; # OUTPUT: «yellow»
702
- say %color{"cherry", "kiwi"}.perl ; # OUTPUT: «("red", "green")»
702
+ say %color{"cherry", "kiwi"}.raku ; # OUTPUT: «("red", "green")»
703
703
say %color{"strawberry"}:exists; # OUTPUT: «False»
704
704
705
705
%color{"banana", "lime"} = "yellowish", "green";
@@ -720,10 +720,10 @@ it independent of the container type.
720
720
= begin code
721
721
use JSON::Tiny;
722
722
723
- my $config = from-json('{ "files": 3, "path": "/home/perl6/perl6 .pod6" }');
724
- say $config.perl ; # OUTPUT: «${:files(3), :path("/home/perl6/perl6 .pod6")}»
723
+ my $config = from-json('{ "files": 3, "path": "/home/some-user/raku .pod6" }');
724
+ say $config.raku ; # OUTPUT: «${:files(3), :path("/home/some-user/raku .pod6")}»
725
725
my %config-hash = $config<>;
726
- say %config-hash.perl ; # OUTPUT: «{:files(3), :path("/home/perl6/perl6 .pod6")}»
726
+ say %config-hash.raku ; # OUTPUT: «{:files(3), :path("/home/some-user/raku .pod6")}»
727
727
= end code
728
728
729
729
It's a C < Hash > in both cases, and it can be used like that; however, in the
@@ -738,7 +738,7 @@ that quotes its argument using the same rules as the L«quote-words operator|
738
738
739
739
my %color = kiwi => "green", banana => "yellow", cherry => "red";
740
740
say %color<banana>; # OUTPUT: «yellow»
741
- say %color<cherry kiwi>.perl ; # OUTPUT: «("red", "green")»
741
+ say %color<cherry kiwi>.raku ; # OUTPUT: «("red", "green")»
742
742
say %color<strawberry>:exists; # OUTPUT: «False»
743
743
744
744
Technically, not a real operator; it's syntactic sugar that's turned into the
@@ -753,7 +753,7 @@ of the same name.
753
753
754
754
my %color = kiwi => "green", banana => "yellow", cherry => "red";
755
755
my $fruit = "kiwi";
756
- say %color«cherry "$fruit"».perl ; # OUTPUT: «("red", "green")»
756
+ say %color«cherry "$fruit"».raku ; # OUTPUT: «("red", "green")»
757
757
758
758
Technically, not a real operator; it's syntactic sugar that's turned into the
759
759
C < { } > postcircumfix operator at compile-time.
@@ -1148,7 +1148,7 @@ Flattens objects of type L<Capture|/type/Capture>, L<Pair|/type/Pair>, L<List|/t
1148
1148
L < Hash|/type/Hash > into an argument list.
1149
1149
1150
1150
sub slurpee( |args ){
1151
- say args.perl
1151
+ say args.raku
1152
1152
};
1153
1153
slurpee( <a b c d>, { e => 3 }, 'e' => 'f' => 33 )
1154
1154
# OUTPUT: «\(("a", "b", "c", "d"), {:e(3)}, :e(:f(33)))»
@@ -1618,7 +1618,7 @@ X<|Any junction operator>
1618
1618
Creates an I < any > L < Junction|/type/Junction > from its arguments.
1619
1619
1620
1620
my $three-letters = /<[a b c]>/ | /<[i j k]>/ | /<[x y z]>/;
1621
- say $three-letters.perl ; # OUTPUT: «any(/<[a b c]>/, /<[i j k]>/, /<[x y z]>/)»
1621
+ say $three-letters.raku ; # OUTPUT: «any(/<[a b c]>/, /<[i j k]>/, /<[x y z]>/)»
1622
1622
say 'b' ~~ $three-letters; # OUTPUT: «True»
1623
1623
1624
1624
This first creates an C < any > C < Junction > of three regular expressions
@@ -2938,7 +2938,7 @@ Constructs a higher-order L<Cool|/type/Cool> from its arguments.
2938
2938
my @list = :god('Þor'), ['is',"mighty"];
2939
2939
say @list; # OUTPUT: «[god => Þor [is mighty]]»
2940
2940
my %hash = :god('Þor'), :is("mighty");
2941
- say %hash.perl ; # OUTPUT: «{:god("Þor"), :is("mighty")}»
2941
+ say %hash.raku ; # OUTPUT: «{:god("Þor"), :is("mighty")}»
2942
2942
my %a = :11a, :22b;
2943
2943
say %(%a, :33x); # OUTPUT: «{a => 11, b => 22, x => 33}»
2944
2944
@@ -2982,7 +2982,7 @@ one of the operands runs out of elements prematurely, the zip operator will
2982
2982
stop.
2983
2983
2984
2984
= for code
2985
- say (1, 2 Z <a b c> Z <+ ->).perl ;
2985
+ say (1, 2 Z <a b c> Z <+ ->).raku ;
2986
2986
# OUTPUT: «((1, "a", "+"), (2, "b", "-")).Seq»
2987
2987
for <a b c> Z <1 2 3 4> -> [$l, $r] {
2988
2988
say "$l:$r"
0 commit comments