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 |
| min minstr / max maxstr (16) | comparison (min / max (binary or more)) |
| 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 / local / use vars | variable assignment or declaration (declaration) |
| sub { my ($a, $b) = @_; ... } | anonymous function |
| { my ($a, $b) = @_; ... } (23) | anonymous function |
| f(a,b,...) | function call |
| &$f(a,b,...) or $f->(a,b,...) | function call |
| f a, b, ... | function call |
| f | function call (with no parameter) |
| f() | function call (with no parameter) |
| &$f or $f->() | function call (with no parameter) |
| AUTOLOAD | function called when a function is not defined (in dynamic languages) |
| sub f { ... } | 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) |
| goto | breaking control flow (goto (unconditional jump)) |
| redo/ | breaking control flow (redo / retry) |
| return | breaking control flow (returning a value) |
| eval {a}; if ($@) b | exception (catching) |
| die | exception (throwing) |
| if (c) {b} | if_then |
| b if c | if_then |
| if (c) {b1} elsif (c2) {b2} else {b3} | if_then_else |
| c ? b1 : b2 | if_then_else |
| unless | ifnot_then (unless) |
| do {expr} until cond | loop (do something until condition) |
| for | loop (for "a la C" (while + initialisation)) |
| for (my $i = 10; $i >= 1; $i--) { expr } | loop (for each value in a numeric range, 1 decrement) |
| foreach my $i (1 .. 10) { expr } | loop (for each value in a numeric range, 1 increment (see also the entries about ranges)) |
| for (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) |
my %case = (
v1 => sub { expr1 },
v2 => sub { expr2 },
);
if ($case{val}) { $case{val}->() } else { expr_else } | multiple selection (switch) |
use Switch;
switch ($val) {
case v1 { expr1 }
case v2 { expr2 }
else expr_else
}) (34) | multiple selection (switch) |
| , | sequence |
| ; | sequence |
| $o->SUPER::method(...) | accessing parent method |
| first parameter | current instance |
| ref | get the type/class corresponding to an object/instance/value |
| can | has the method |
| @ISA = qw(parent1 parent2) | inheritance |
| DESTROY | manually call an object's destructor |
| object->method(para) | method invocation |
| object->method | method invocation (with no parameter) |
| dclone | object cloning |
| new class_name(...) | object creation |
| isa | testing class membership |
| package p; | declare |
| @ISA = qw(Exporter); @EXPORT = qw(name1 name2 ...); | declare (selective export) |
| use p (51) | import (everything into current namespace) |
| use p; (52) | import (package (ie. load the package)) |
| require p | import (package (ie. load the package)) |
| use p qw(name1 name2 ...) | import (selectively) |
| :: | package scope |
| ' | package scope |
| chr | ascii to character |
| ord | character to ascii |
| Dumper | 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) | |
| printf | simple print (printf-like) |
| sprintf | sprintf-like |
| . | string concatenation |
| eq ne | string equality & inequality |
| length | string size |
| "\n" | strings (end-of-line (without writing the real CR or LF character)) |
| '...' | strings (verbatim) |
| <<'MARK' ... MARK | strings (verbatim) |
| q(...(...)...), q[...], q{...}, q<...>, q/.../ | strings (verbatim) |
| "... $v ..." | strings (with interpolation) |
| <<MARK ... $v ... MARK | strings (with interpolation) |
| qq(...(... $v ...)...), qq[...], qq{...}, qq<...>, qq/.../ | strings (with interpolation) |
| 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 (short circuit) |
| or / and | logical or / and (short circuit) |
| anything not false | true value |
| unshift | adding an element at the beginning (list cons) (side-effect) |
| push | adding an element at the end (side-effect) |
| reduce (16) | f(... f(f(init, e1), e2) ..., en) |
| first (16) | find an element |
| for | for each element do something |
| foreach | for each element do something |
| 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[-1] | last element |
| , (66) | list concatenation |
| [ a, b, c ] | list constructor |
| ( a, b, c ) | list constructor |
| scalar @l | list size |
| a[i] | list/array indexing |
| reverse | reverse |
| min minstr / max maxstr (16) | smallest / biggest element |
| sort | sort |
| map | transform a list (or bag) in another one |
Missing:
adding an element at 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) |
| t | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) (using a tuple for a function call) |
| $h{k} | dictionary (access: read/write) |
| { a => b, c => d } | dictionary (constructor) |
| { a, b, c, d } | dictionary (constructor) |
| exists $h{k} | dictionary (has the key ?) |
| keys | dictionary (list of keys) |
| values | dictionary (list of values) |
| delete $h{k} | dictionary (remove by key) |
| undef | optional value (null value) |
| v | optional value (value) |
| v | optional value (value) |
| a .. b | range (inclusive .. inclusive) |
| \ | reference (pointer) (creation) |
| $ @ % & (78) | reference (pointer) (dereference) |
| ->[...] ->{...} ->(...) (79) | reference (pointer) (dereference) |
| ( a, b, c ) | tuple constructor |
| + / - / * / / | addition / subtraction / multiplication / division |
| & / | / ^ | bitwise operators (and / or / xor) |
| << / >> | bitwise operators (left shift / right shift / unsigned right shift) |
| ~ | bitwise operators (negation) |
| ** | 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, 07, 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) |
| int / / floor / ceil | truncate / round / floor / ceil |