You are reading the article written before the rename. What is said here, most likely still works, but you may want considering to review the differences after the rename. The texts published on this site prior to the rename will stay unchanged for reflecting the historical truth.

In October 2019, Perl 6 has been renamed to Raku. Its grammar, syntax, sigils, and everything remain the same, but when reading this article, please read Perl 6 as Raku .

N. B. Perl 6 has been renamed to Raku. Click to read more.

The Int type is intended to host integer variables of arbitrary size. For example, no digit is lost in the following assignment:

my Int $x = 12389147319583948275874801735817503285431532; say $x;

A special syntax exists for defining integers with an other-than-10 base:

say :16<D0CF11E0>

Also, it is allowable to use the underscore character to separate digits so that big numbers can be read more easily:

my Int $x = 735_817_503_285_431_532;

Of course, when you print the value, all the underscores are gone.

On the Int object, you may call some other handy methods, for example, to convert a number to a character or to check if the integer in hand is prime (yes, is-prime is a built-in method!).

my Int $a = 65; say $a.chr; # A my Int $i = 17; say $i.is-prime; # True say 42.is-prime; # False