Variables
Twigils
, 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.
int1
int2
int4
int8
int16
int32 (aka int on 32-bit machines)
int64 (aka int on 64-bit machines)
uint1 (aka bit)
uint2
uint4
uint8 (aka byte)
uint16
uint32
uint64
num32
num64 (aka num on most architectures)
num128
complex32
complex64 (aka complex on most architectures)
complex128
Str
Operatoren
Vorrangtabelle
V steht f�r Vorrang, meint ob linke (L) oder rechte (R) Seite des Operators bevorzugt wird.
V Level Beispiele
= ===== ========
N Ausdr�cke 42 3.14 "eek" qq["foo"] $x :!beliebig @$array
L Methoden postfix .name .+ .? .* .() .[] .{} .<> .�� .:: .= .^ .:
L Autoinkrement ++ --
R potenzieren **
L symbolische un�re ! + - ~ ? | +^ ~^ ?^ \ ^ =
L multiplizierende * / % +& +< +> ~& ~< ~> ?& div mod
L addierende + - +| +^ ~| ~^ ?| ?^
N wiederhohlend x xx
L verbindend ~
X junctives und & (all)
X junction oder | ^ (any)
L benannte un�re rand sleep abs etc.
N nichtkettend infix but does <=> leg cmp .. ..^ ^.. ^..^
C verkettend infix != == < <= > >= eq ne lt le gt ge ~~ === eqv !eqv
L und (hoh. Vorrang) &&
L oder (hoh. Vorrang) || ^^ // min max
L bedingt ?? !! ff fff
R Zuweisungen = := ::= => += -= **= xx= .=
L lose un�re true not
X Kommaoperator , p5=>
X listen op (infix) Z minmax X X~X X*X XeqvX
R listen op (prefix) : print push say die map substr ... + * any $ @
L loses and and andthen
L loses or or xor orelse
N Ausdruck Begrenzer ; <==, ==>, <<==, ==>>, {...}, Ausdruckmodifikatoren, unless, extra ), ], }
Unicodeoperatoren
<< > >
Rule Primitven
\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).
Ablaufkontrolle
Closure Traits
Dies sind Sonderbl�cke die jedem Block beigef�gt werden und ihm dadurch zus�tzliche Eigenschaften geben.
BEGIN {...}* zur compilezeit, so f�h wie m�glich, nur 1x ausgef�hrt
CHECK {...}* zur compilezeit, so sp�t wie m�glich, nur 1x ausgef�hrt
INIT {...}* zur Laufzeit, so f�h wie m�glich, nur 1x ausgef�hrt
END {...} zur Laufzeit, so sp�t wie m�glich, nur 1x ausgef�hrt
START {...}* bei ersten Ausf�hrung, einmal je Klone
ENTER {...}* vor jeder Ausf�hrung, mehrmals bei Schleifen
LEAVE {...} w�hrend jeden Verlassen des Blocks
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, vor LEAVE
CONTROL {...} catch control exceptions, vor LEAVE