module

A module is a piece of code which is usually located in a separate file with the name which may be guessed from the module name.

Modules start with the keyword module. There are two ways of using it.

The first line declares the module, and the rest of the file is its content:

module X;

sub x() {
    say "X::x()";
}

It is also possible to use a block to hold the body of the module:

module X {
    sub x() {
        say "X::x()";
    }
}