The "Missing:"s below indicate that an entry is incomplete.
{ ... } (9) | block (grouping statements, especially when statements are not expressions) |
nothing needed | breaking lines (useful when end-of-line and/or indentation has a special meaning) |
# | commenting (until end of line) |
< > <= >= | comparison |
lt gt le ge | comparison |
a <=> b | comparison (returns 3 values (i.e. inferior, equal or superior)) |
cmp | comparison (returns 3 values (i.e. inferior, equal or superior)) |
=pod ... =cut(3) | documentation comment |
== != | equality / inequality (shallow) |
incremental garbage collection => not needed | force garbage collection |
( ... ) | grouping expressions |
$?LINE $?FILE | information about the current line and file |
eval | runtime evaluation |
case-sensitive | tokens (case-sensitivity (keywords, variable identifiers...)) |
CamelCase for modules, ALL_CAPS for constants, unclear for functions / variables | tokens (if case sensitive, what is the standard way for scrunching together multiple words) |
[_a-zA-Z][_a-zA-Z0-9]* | tokens (variable identifier regexp) |
do | use a block as a return value (when statements are not expressions) |
= | variable assignment or declaration (assignment) |
my / our / temp | variable assignment or declaration (declaration) |
Missing:
comparison (min / max (binary or more))
&f.assuming(var_name => a) | partial application (in the examples below, a normal call is "f(a,b)") (give the first argument) |
&f.assuming(b => b) | partial application (in the examples below, a normal call is "f(a,b)") (give the second argument) |
-> $a, $b { ... } | anonymous function |
f(a,b,...) | function call |
$f.(a,b,...) | function call |
f | function call (with no parameter) |
$f.() | function call (with no parameter) |
AUTOSCALAR, AUTOMETH, AUTOLOAD... | function called when a function is not defined (in dynamic languages) |
sub f { ... } | function definition |
sub f($para1, $para2, ...) { ... } | function definition |
return | function return value (breaks the control flow) |
no syntax needed | function return value (function body is the result) |
caller | runtime inspecting the caller information |
next / last | breaking control flow (continue / break) |
redo/ | breaking control flow (redo / retry) |
return | breaking control flow (returning a value) |
try { a CATCH exn { b } } | exception (catching) |
die | exception (throwing) |
if c {b} | if_then |
c ?? b1 :: b2 | if_then_else |
do expr until cond | loop (do something until condition) |
loop | loop (for "a la C" (while + initialisation)) |
loop (my $i = 10; $i >= 1; $i--) { expr } | loop (for each value in a numeric range, 1 decrement) |
for (1 .. 10) -> $i { expr } | loop (for each value in a numeric range, 1 increment (see also the entries about ranges)) |
loop (my $i = 1; $i <= 10; $i += 2) { expr } | loop (for each value in a numeric range, free increment) |
while (cond) expr | loop (while condition do something) |
given $val { when v1 { expr1 } when v2 { expr2 } default { expr_else } } | multiple selection (switch) |
; | sequence |
Missing:
breaking control flow (goto (unconditional jump))
t v | annotation (or variable declaration) |
Missing:
declaration
cast
mutability, constness (type of a mutable value)
mutability, constness (type of a constant value)
$o.SUPER::method(...) | accessing parent method |
class | class declaration |
. | current instance |
meta | get the type/class corresponding to an object/instance/value |
can | has the method |
class child is parent { ... } | inheritance |
object.method(para) | method invocation |
object.method | method invocation (with no parameter) |
o.meta.getmethods | methods available |
o.clone | object cloning |
class_name.new(...) | object creation |
o.meta.isa | testing class membership |
Missing:
manually call an object's destructor
Missing:
package scope
declare
import
chr | ascii to character |
ord | character to ascii |
Char | character type name |
perl | convert something to a string (see also string interpolation) |
"" ~ e | convert something to a string (see also string interpolation) |
x | duplicate n times |
substr | extract a substring |
index | locate a substring |
rindex | locate a substring (starting at the end) |
all strings allow multi-line strings | multi-line |
simple print (on simple objects) | |
say (57) | simple print (on simple objects) |
sprintf | sprintf-like |
~ | string concatenation |
eq ne | string equality & inequality |
bytes chars | string size |
"\n" | strings (end-of-line (without writing the real CR or LF character)) |
'...' | strings (verbatim) |
q(...(...)...), q[...], q{...}, q<...>, q/.../ | strings (verbatim) |
"... $v ..." | strings (with interpolation) |
qq(...(... $v ...)...), qq[...], qq{...}, qq<...>, qq/.../ | strings (with interpolation) |
Str | type name |
uc / lc | upper / lower case character |
uc / lc | uppercase / lowercase / capitalized string |
Missing:
serialize (marshaling)
unserialize (un-marshaling)
undef / 0 / "0" / "" / () | false value |
! | logical not |
not | logical not |
?| / | logical or / and (non short circuit (always evaluates both arguments)) |
|| / && | logical or / and (short circuit) |
or / and | logical or / and (short circuit) |
anything not false | true value |
Bool | type name |
unshift | adding an element at the beginning (list cons) (side-effect) |
push | adding an element at the end (side-effect) |
reduce | f(... f(f(init, e1), e2) ..., en) |
shift | get the first element and remove it |
pop | get the last element and remove it |
join | join a list of strings in a string using a glue string |
grep | keep elements matching |
[ a, b, c ] | list constructor |
( a, b, c ) | list constructor |
zip | list of couples from 2 lists |
elems | list size |
a[i] | list/array indexing |
uniq | remove duplicates |
reverse | reverse |
min / max | smallest / biggest element |
sort | sort |
Array or List | type name |
Missing:
list concatenation
list flattening
adding an element at index
first element
all but the first element
last element
for each element do something
transform a list (or bag) in another one
transform two lists in parallel
find an element
is an element in the list
is the predicate true for an element
is the predicate true for every element
iterate with index
a, | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (1-uple) |
() | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (empty tuple) |
%h{k} or %h<s> | dictionary (access: read/write) |
{ a => b, c => d } | dictionary (constructor) |
exists | dictionary (has the key ?) |
keys | dictionary (list of keys) |
values | dictionary (list of values) |
delete | dictionary (remove by key) |
Hash | dictionary (type name) |
Missing:
tuple type
tuple constructor
computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (using a tuple for a function call)
reference (pointer) (creation)
reference (pointer) (dereference)
optional value (null value)
optional value (value)
record selector
range
+ / - / * / / | addition / subtraction / multiplication / division |
+& / +| / +^ | bitwise operators (and / or / xor) |
** | exponentiation (power) |
log / log10 | logarithm |
% | modulo (modulo of -3 / 2 is 1) |
- | negation |
1000, 1000.0, 1E3 (84) | numbers syntax (decimals) |
1_000, 10_00, 100_0 | numbers syntax (integer thousand-seperator) |
0b1, 0o7, 0xf | numbers syntax (integers in base 2, octal and hexadecimal) |
1000 | numbers syntax (integers) |
mathematical | operator priorities and associativities (addition vs multiplication) |
mathematical | operator priorities and associativities (exponentiation vs negation (is -3^2 equal to 9 or -9)) |
rand | random (random number) |
srand | random (seed the pseudo random generator) |
sqrt / exp / abs | square root / e-exponential / absolute value |
sin / cos / tan | trigonometry (basic) |
asin / acos / atan (88) | trigonometry (inverse) |
truncate / round / floor / ceiling | truncate / round / floor / ceil |
Rat | type name (decimal) |
Int | type name (integers) |