Raku Books / Perl 6 at a Glance / Perl 6 Essentials

Built-in types

Perl 6 allows using typed variables. To tell the compiler that the variable is typed, you simply need to name the type while declaring the variable.

Some of the types available in Perl 6 are obvious and do not need comments:

Bool, Int, Str

Array, Hash, Complex

Some might require a small comment:

Num, Pair, Rat

The Num type is used to handle floating-point variables, and a Pair is a “key; value” pair. The Rat type introduces rational numbers with numerators and denominators.

Topics in this section

Course navigation

Frequently used special variables   |   Typed variables