home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeJava and XSLTSearch this book

8.26. 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

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.