Special variables: Difference between revisions

Content added Content deleted
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Raku}}: Fix link: Perl 6 --> Raku (but stale, needs more work))
Line 1,638: Line 1,638:
(formerly Perl 6)
(formerly Perl 6)


It is probably useful to briefly explain normal variables in Perl 6 before tackling special variables.
It is probably useful to briefly explain normal variables in Raku before tackling special variables.


Variables in Perl 6 have a prefix sigil to distinguish them from named subroutines, functions, classes, and so on. There is a system of sigils to mark the fundamental structural type of the variable:
Variables in Raku have a prefix sigil to distinguish them from named subroutines, functions, classes, and so on. There is a system of sigils to mark the fundamental structural type of the variable:
<lang perl6> $foo scalar (object)
<lang perl6> $foo scalar (object)
@foo ordered array
@foo ordered array
Line 1,660: Line 1,660:
Special Variables:
Special Variables:


Perl 6 has deprecated most of the "line-noise" variables from Perl 5 in favor of named variables.
Raku has deprecated most of the "line-noise" variables from Perl 5 in favor of named variables.


<lang perl6> $_ # The implicit variable lexically scoped to the current block
<lang perl6> $_ # The implicit variable lexically scoped to the current block
Line 1,703: Line 1,703:
$*OUT # Standard output handle
$*OUT # Standard output handle
$?PACKAGE # current package
$?PACKAGE # current package
$?PERL # Which Perl am I compiled for?
$*RAKU # Raku version running under
$*PERL # perl version running under
$*PID # system process id
$*PID # system process id
%=POD # POD
%=POD # POD
$*PROGRAM_NAME # name of the Perl program being executed
$*PROGRAM_NAME # name of the Raku program being executed
%*PROTOCOLS # Stores the methods needed for the uri() function
%*PROTOCOLS # Stores the methods needed for the uri() function
::?ROLE # current role (as package or type name)
::?ROLE # current role (as package or type name)