Skip to content

Instantly share code, notes, and snippets.

# Detects binary number which is multiple of 3
# Example of subroutines in regexps
while (<>) {
print if /
(?(DEFINE)
(?'A' (?:0(?P>F))? | (?:1(?P>B))? )
)
(?(DEFINE)
(?'B' (?:1(?P>A)) | (?:0(?P>C)) )