Number::Convert - Perl extension to convert numbers between different base systems.
use Number::Convert; my $a = new Number::Convert(0xff); $a += "abcdef"; $a ^= 0b000011111; print $a->ToBinary()."\n"; print Number::Convert->new(0xff)->ToDecimal()."\n";
This extension provides for easy conversion of numbers between different bases. It currently supports base 2, 8, 10 & 16 (binary, octal, decimal & hex). It also supports basic perl operations on numbers such as add, subtract, multiply, divide and a few bitwise operators such as and, or, xor.
The following binary operators have been overloaded so that you can perform operations on Number::Convert objects as if they were normal scalars.
+, -, *, /, &, |, ^ (xor)
Will return the number in decimal format
Will return the number in binary format
Will return the number in hexadecimal format
Will return the number in hexadecimal format, but using uppercase for letters A-Z.
Will return the number in octal format.
If you have any questions/issues, please feel free to reach out to the author.
Karthik Umashankar <karthiku@cpan.org>
Copyright (C) 2010 by Karthik Umashankar
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Number::Convert, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Number::Convert
CPAN shell
perl -MCPAN -e shell install Number::Convert
For more information on module installation, please visit the detailed CPAN module installation guide.