Object Types

Any scalar variable (arrays and hashes are just collections of scalars) can hold any type of data. Nevertheless Perl knows for many data types specific classes (known as data types) that can handle them.

Regex Modifier

Stay behind the regex op and change the behaviour of the regex, search scope, etc.

Short

Long

Meaning

:g

:global

searches for any finding

:x(n)

searches n times (n is an int)

:nth

:st :nd :rd :th

demands the nth finding, has many aliases for correct spelling (:2nd)

:c(n)

:continue

searches from nth position (counting from 0)

:p(n)

:pos

searches only on nth position (counting from 0)

:ov

:overlap

searches on all positionens just one time (activates backtracking)

:ex

:exhaustive

searches on all positionens as long as it findes something (activates backtracking)

:ratchet

deactivates backtracking

:panic

overwriting of possible set :ratchet for all subrules (activates backtracking)

:keepall

subrules have to memorize everything

:rw

the regex has the right to change the string

:s

:sigspace

whitespace just separate parts of the Regex, don't stand for spaces to look for

:ss

:samespace

as in :s for substitutions, 1st part replaced with 1st part in second half a.s.o. (ss/teh hsa/the has/;)

:i

:ignorecase

no distinctions between uppercase and lowercase

:ii

:samecase

substitute with chars of same case as the matching

:a

:ignoreaccent

no distinctions between same chars with or without accent (funny symbols above)

:aa

:sameaccent

substitute with chars that has same accent as the matching

:bytes

searches on byte level

:chars

searches on character level (default)

:codes

matches between codepoints

:graphs

match language-independent graphemes

:P5

:Perl5

use the old Regex

Flow Control

Jump Commands

goto
redo
next
last
leave
return

Closure Traits

Every block can contain special named blocks (some are only for loops) that are started at certain times. They are traits (compile time property) of a block object and can modify behaviour of that block. 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