Karthik Umashankar > Number-Convert-1.0 > Number::Convert

Download:
Number-Convert-1.0.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.0   Source   Latest Release: Number-Convert.1.0.2

Number::Convert ^

Number::Convert - Perl extension to convert numbers between different base systems.

SYNOPSIS ^

        use Number::Convert;

        my $a = new Number::Convert(0xff);

        $a += "abcdef";
        $a ^= 0b000011111;

        print $a->ToBinary()."\n";

        print Number::Convert->new(0xff)->ToDecimal()."\n";

DESCRIPTION ^

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.

Overloaded operators.

The following binary operators have been overloaded so that you can perform operations on Number::Convert objects as if they were normal scalars.

+, -, *, /, &, |, ^ (xor)

Other functions

ToDecimal

Will return the number in decimal format

ToBinary

Will return the number in binary format

ToHex

Will return the number in hexadecimal format

ToUpperCaseHex

Will return the number in hexadecimal format, but using uppercase for letters A-Z.

ToOctal

Will return the number in octal format.

SEE ALSO ^

If you have any questions/issues, please feel free to reach out to the author.

AUTHOR ^

Karthik Umashankar <karthiku@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: