Perl 6
Perl Lookup Table: Revision 4



, or secundary sigils. They follow after a $ (scalar), @ (array) or % (hash), and mark special namespaces or variables with special meaning and properties.

$foo ..... ordinary scoping
$.foo .... object attribute public accessor
$^foo ... self-declared formal positional parameter
$:foo .... self-declared formal named parameter
$*foo .... contextualizable global variable
$?foo .... compiler hint variable
$=foo .... pod variable
$<foo> .. match variable, short for $/{'foo'}
$!foo ..... object attribute private storage
$~foo .... the foo sublanguage seen by the parser at this lexical spot

Special Variables

$*ARGS .... Arguments (Parameter) to a program (script)
$*IN ... Standard input handle (command line)
$*OUT # Standardausgabe
$*ERR # Standardfehlerausgabe
$*PERLVER # aktuelle Perlversion
$*OS # Auf welchem Betriebsystem lauf ich gerade?
$?OS ... what welches Betriebsystem kompiliert?
$?PARSER # Welche Grammar wurde f�r aktuelle Zeile benutzt?
@?BLOCK # In welchen Bl�cken bin ich gerade?
$?LINE # In welcher Zeile bin ich?
$~MAIN.......the current main language (e.g. Perl statements)
$~Q............the current root of quoting language
$~Quasi.......the current root of quasiquoting language
$~Regex......the current root of regex language
$~Trans.......the current root of transliteration language
$~P5Regex...the current root of the Perl regex language

Object Types

In der linken Spalte seht ihr Schl�sselworte f�r die verschiednen logischen Typen die Variablen in Perl 6 haben k�nnen.

Bit ......Perl single bit (allows traits, aliasing, undef, etc.)
Int ...... Perl integer (allows Inf/NaN, arbitrary precision, etc.)
Str ...... Perl string (finite sequence of Unicode characters)
Num ...... Perl number
Complex Perl complex number
Bool Perl boolean
Exception Perl exception
Code Base class for all executable objects
Block Executable objects that have lexical scopes
List Lazy Perl list (composed of immutables and iterators)
Seq Completely evaluated (hence immutable) sequence
Range A pair of Ordered endpoints; gens immutables when iterated
Set Unordered collection of values that allows no duplicates
Bag Unordered collection of values that allows duplicates
Junction Set with additional behaviors
Pair A single key-to-value association
Mapping Set of Pairs with no duplicate keys
Signature Function parameters (left-hand side of a binding)
Capture Function call arguments (right-hand side of a binding)
Blob An undifferentiated mass of bits

low level data types

Dies ist etwas mehr low level als die vorige Tabelle und dient eher dazu dem Interpreter mitzuteilen wie viel Platz diese Variable ben�tigt, das er es optimieren kann.

int32 (aka int on 32-bit machines)
int64 (aka int on 64-bit machines)
uint1 (aka bit)
uint8 (aka byte)
num64 (aka num on most architectures)
complex64 (aka complex on most architectures)


Table of precedence

A Level Examples
= ===== ========
N Terms 42 3.14 "eek" qq["foo"] $x :!verbose @$array
L Method postfix .meth .+ .? .* .() .[] .{} .<> .«» .:: .= .^ .:
N Autoincrement ++ --
R Exponentiation **
L Symbolic unary ! + - ~ ? | +^ ~^ ?^ ^
L Multiplicative * / % +& +< +> ~& ~< ~> ?& div mod
L Additive + - +| +^ ~| ~^ ?| ?^
L Replication x xx
X Concatenation ~
X Junctive and & also
X Junctive or | ^
L Named unary sleep abs sin temp let
N Nonchaining infix but does <=> leg cmp .. ..^ ^.. ^..^
C Chaining infix != == < <= > >= eq ne lt le gt ge ~~ === eqv !eqv
X Tight and &&
X Tight or || ^^ // min max
R Conditional ?? !! ff fff
R Item assignment = := ::= => += -= **= xx= .=
L Loose unary true not :by(2)
X Comma operator , p5=> :
X List infix Z minmax X X~ X* Xeqv ...
R List prefix print push say die map substr ... + * any $ @
X Loose and and andthen
X Loose or or xor orelse
X Sequencer <==, ==>, <<==, ==>>
N Terminator ; {...}, unless, extra ), ], }

  Assoc Meaning of $a ! $b ! $c
L left ($a ! $b) ! $c
R right $a ! ($b ! $c)
C chain ($a ! $b) and ($b ! $c)
X list infix:<!>($a; $b; $c)


$_ X Type of Match Wanted What to use on the right
Array Num array element truth .X
Array Num array contains number ,X,
Array Str array contains string ,X,
Array Seq array begins with seq X,*
Array Seq array contains seq ,X,
Array Seq array ends with seq *,X
Hash Str hash element truth .{X}
Hash Str hash key existence .{X}:exists
Hash Num hash element truth .{X}
Hash Num hash key existence .{X}:exists
Buf Int buffer contains int .match(X)
Str Char string contains char .match(X)
Str Str string contains string .match(X)
Array Scalar array contains item .any === X
Str Array array contains string X.any
Num Array array contains number X.any
Scalar Array array contains object X.any
Hash Array hash slice exists .{X.all}:exists .{X.any}:exists
Set Set subset relation .{X}:exists
Set Hash subset relation .{X}:exists
Any Set subset relation .Set.{X}:exists
Any Hash subset relation .Set.{X}:exists
Any Set superset relation X.{$_}:exists
Any Hash superset relation X.{$_}:exists
Any Set sets intersect .{X.any}:exists
Set Array subset relation X,* # (conjectured)
Array Regex match array as string .Cat.match(X); cat(@$_).match(X)

Unicode operators


Rule primitvs

\0[ . . . ] Match a character given in octal (brackets optional).
\b Match a word boundary.
\B Match when not on a word boundary.
\c[ . . . ] Match a named character or control character.
\C[ . . . ] Match any character except the bracketed named or control character.
\d Match a digit.
\D Match a nondigit.
\e Match an escape character.
\E Match anything but an escape character.
\f Match the form feed character.
\F Match anything but a form feed.
\n Match a (logical) newline.
\N Match anything but a (logical) newline.
\h Match horizontal whitespace.
\H Match anything but horizontal whitespace.
\L[ . . . ] Everything within the brackets is lowercase.
\Q[ . . . ] All metacharacters within the brackets match as literal characters.
\r Match a return.
\R Match anything but a return.
\s Match any whitespace character.
\S Match anything but whitespace.
\t Match a tab.
\T Match anything but a tab.
\U[ . . . ] Everything within the brackets is uppercase.
\v Match vertical whitespace.
\V Match anything but vertical whitespace.
\w Match a word character (Unicode alphanumeric plus "_").
\W Match anything but a word character.
\x[ . . . ] Match a character given in hexadecimal (brackets optional).
\X[ . . . ] Match anything but the character given in hexadecimal (brackets optional).


Closure Traits

in every block can be inserted several special named blocks that are started at certain times. Because they are treated as part of a block object, they are called traits. Those marked with a * can also be used within an expression.

BEGIN {...}* at compile time, ASAP, only ever runs once
CHECK {...}* at compile time, ALAP, only ever runs once

INIT {...}* at run time, ASAP, only ever runs once
END {...} at run time, ALAP, only ever runs once

START {...}* on first ever execution, once per closure clone
ENTER {...}* at every block entry time, repeats on loop blocks.
LEAVE {...} at every block exit time
KEEP {...} at every successful block exit, part of LEAVE queue
UNDO {...} at every unsuccessful block exit, part of LEAVE queue

FIRST {...}* at loop initialization time, before any ENTER
NEXT {...} at loop continuation time, before any LEAVE
LAST {...} at loop termination time, after any LEAVE

PRE {...} assert precondition at every block entry, before ENTER
POST {...} assert postcondition at every block exit, after LEAVE

CATCH {...} catch exceptions, before LEAVE
CONTROL {...} catch control exceptions, before LEAVE

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.