@@ -162,15 +162,15 @@ List C<(42, "str")> is list-assigned to C<@array>:
162
162
163
163
my @array;
164
164
@array = my $num = 42, "str"; # parsed as @array = ( (my $num = 42), "str )
165
- say @array.perl ; # OUTPUT: «[42, "str"]» (an Array)
166
- say $num.perl ; # OUTPUT: «42» (a Num)
165
+ say @array.raku ; # OUTPUT: «[42, "str"]» (an Array)
166
+ say $num.raku ; # OUTPUT: «42» (a Num)
167
167
168
168
Here's a variant:
169
169
170
170
my ( @foo, $bar );
171
171
@foo = ($bar) = 42, "str"; # parsed as @foo = ( $bar = (42, "str") )
172
- say $bar.perl ; # OUTPUT: «$(42, "str")» (a List)#
173
- say @foo.perl ; # OUTPUT: «[(42, "str"),]» (an Array)
172
+ say $bar.raku ; # OUTPUT: «$(42, "str")» (a List)#
173
+ say @foo.raku ; # OUTPUT: «[(42, "str"),]» (an Array)
174
174
175
175
In this case, the list contextualizer C < ( ) > puts C < $bar > in a list context, and
176
176
thus triggers a list assignment to the Scalar variable C < $bar > . This means that
@@ -206,10 +206,10 @@ Sigilless variables do not enforce L<context|/language/contexts>, so they can be
206
206
used to pass something on as-is:
207
207
208
208
sub logged(&f, |args) {
209
- say('Calling ' ~ &f.name ~ ' with arguments ' ~ args.perl );
209
+ say('Calling ' ~ &f.name ~ ' with arguments ' ~ args.raku );
210
210
my \result = f(|args);
211
211
# ^^^^^^^ not enforcing any context here
212
- say(&f.name ~ ' returned ' ~ result.perl );
212
+ say(&f.name ~ ' returned ' ~ result.raku );
213
213
return |result;
214
214
}
215
215
@@ -459,7 +459,7 @@ following are useful:
459
459
X < |$~MAIN > X < |$~Quote > X < |$~Quasi > X < |$~Regex > X < |$~Trans > X < |$~P5Regex >
460
460
461
461
= begin table
462
- $~MAIN the current main language (e.g. Perl statements)
462
+ $~MAIN the current main language (e.g., Raku statements)
463
463
$~Quote the current root of quoting language
464
464
$~Quasi the current root of quasiquoting language
465
465
$~Regex the current root of regex language
@@ -609,7 +609,7 @@ elements are left will result in undefined values according to the type of the
609
609
variables.
610
610
611
611
my (Str $a, Str $b, Int $c) = <a b>;
612
- say [$a, $b, $c].perl ;
612
+ say [$a, $b, $c].raku ;
613
613
# OUTPUT: «["a", "b", Int]»
614
614
615
615
To destructure a list into a single value, create a list literal with one
@@ -618,13 +618,13 @@ parentheses around a single variable is sufficient.
618
618
619
619
sub f { 1,2,3 };
620
620
my ($a) = f;
621
- say $a.perl ;
621
+ say $a.raku ;
622
622
# OUTPUT: «1»
623
623
624
624
To skip elements in the list use the anonymous state variable C < $ > .
625
625
626
626
my ($,$a,$,%h) = ('a', 'b', [1,2,3], {:1th});
627
- say [$a, %h].perl ;
627
+ say [$a, %h].raku ;
628
628
# OUTPUT: «["b", {:th(1)}]»
629
629
630
630
= head2 The C < has > declarator
@@ -775,14 +775,14 @@ Furthermore, state variables can be used outside of subroutines. You
775
775
could, for example, use C < $ > in a one-liner to number the lines in a file.
776
776
777
777
= begin code :lang<shell>
778
- perl6 -ne 'say ++$ ~ " $_"' example.txt
778
+ raku -ne 'say ++$ ~ " $_"' example.txt
779
779
= end code
780
780
781
781
Each reference to C < $ > within a lexical scope is in effect a separate
782
782
variable.
783
783
784
784
= begin code :lang<shell>
785
- perl6 -e '{ say ++$; say $++ } for ^5'
785
+ raku -e '{ say ++$; say $++ } for ^5'
786
786
# OUTPUT: «1021324354»
787
787
= end code
788
788
@@ -1488,7 +1488,7 @@ This shows additional information on the operating system and version it's
1488
1488
using, but as a matter of fact, this variable contains information which is
1489
1489
useful to create portable programs, such as the path separator:
1490
1490
1491
- say $*DISTRO.perl ;
1491
+ say $*DISTRO.raku ;
1492
1492
# OUTPUT: «Distro.new(release => "42.3", is-win => Bool::False,
1493
1493
# path-sep => ":", name => "opensuse",
1494
1494
# auth => "https://www.opensuse.org/", version => v42.3,
@@ -1548,7 +1548,7 @@ X<|$*PROGRAM-NAME>
1548
1548
= head4 C < $*PROGRAM-NAME >
1549
1549
1550
1550
This contains the path to the current executable as it was entered on the
1551
- command line, or C < -e > if perl was invoked with the -e flag.
1551
+ command line, or C < -e > if raku was invoked with the -e flag.
1552
1552
1553
1553
X < |$*PROGRAM >
1554
1554
= head4 C < $*PROGRAM >
@@ -1566,15 +1566,15 @@ Raku is embedded in another language runtime (such as Inline::Perl6 in Perl 5).
1566
1566
X < |$*EXECUTABLE >
1567
1567
= head4 C < $*EXECUTABLE >
1568
1568
1569
- Contains an C < IO::Path > absolute path of the perl executable that is currently
1569
+ Contains an C < IO::Path > absolute path of the raku executable that is currently
1570
1570
running.
1571
1571
1572
1572
X < |$*EXECUTABLE-NAME >
1573
1573
= head4 C < $*EXECUTABLE-NAME >
1574
1574
1575
- Contains the name of the Perl executable that is currently running. (e.g.
1576
- perl6 -p, perl6 -m). Favor C < $*EXECUTABLE > over this one, since it's not
1577
- guaranteed that the perl executable is in C < PATH > .
1575
+ Contains the name of the Raku executable that is currently running. (e.g.
1576
+ raku -p, raku -m). Favor C < $*EXECUTABLE > over this one, since it's not
1577
+ guaranteed that the raku executable is in C < PATH > .
1578
1578
1579
1579
X < |$*USAGE >
1580
1580
= head4 C < $*USAGE >
@@ -1648,7 +1648,7 @@ By default this imposes a maximum of 64 threads on the methods C<.hyper>,
1648
1648
C < .race > and other thread-pool classes that use that scheduler such as
1649
1649
C < Promise > s or C < Supply > s. This is, however, implementation, dependent and might
1650
1650
be subject to change. To change the maximum number of threads, you can either
1651
- set the environment variable C < RAKUDO_MAX_THREADS > before running perl6 or
1651
+ set the environment variable C < RAKUDO_MAX_THREADS > before running raku or
1652
1652
create a scoped copy with the default changed before using them:
1653
1653
1654
1654
my $*SCHEDULER = ThreadPoolScheduler.new( max_threads => 128 );
@@ -1669,7 +1669,7 @@ message.
1669
1669
1670
1670
= for code
1671
1671
sub MAIN($a, :$b, UInt :$ehehe) {
1672
- say $*USAGE; # OUTPUT: «Usage: perl6.pl6 [-a=<Int>] [-b=<Str>] [--<opts>=...]»
1672
+ say $*USAGE; # OUTPUT: «Usage: my-script.raku [-a=<Int>] [-b=<Str>] [--<opts>=...]»
1673
1673
}
1674
1674
1675
1675
It is accessible only inside of MAIN sub.
0 commit comments