Special variables: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
SqrtNegInf (talk | contribs) 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 |
It is probably useful to briefly explain normal variables in Raku before tackling special variables. |
||
Variables in |
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: |
||
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 |
||
$ |
$*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 |
$*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) |