bigint

Provides big-integer support for Perl. Prior to 5.8, and for 32-bit architectures, Perl supported whatever numbers your platform supported. This wasn’t always the best solution when dealing with large numbers. Thus, the integer-related math modules were born, including Math::BigInt and bigint. Math::BigInt and bigint override all of the core Perl math functions and still support large integers. As of Perl 5.8, bigint.pm is shipped with the Perl source kit.

For example:

#!/usr/local/bin/perl -w
use bigint;

my $num1 = 4;
my $num2 = 1024;
 print $num1 ** $num2, "\n";  # Prints a very large number

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.