Perl | Math::BigInt->from_hex() method
Math::BigInt module in Perl provides objects that represent integers with arbitrary precision and overloaded arithmetical operators.
from_hex() method of Math::BigInt module is used to convert the hexadecimal number passed as input to its corresponding decimal number.
Syntax: Math::BigInt->from_hex()
Parameter: input hexadecimal number to be converted
Returns: a corresponding decimal number of the passed hexadecimal number
Example 1:
perl
#!/usr/bin/perl
use Math::BigInt;
$x = Math::BigInt->from_hex( "3E8" );
print ( "$x\n" );
$x = Math::BigInt->from_hex( "D75A" );
print ( "$x\n" );
|
Example 2:
perl
#!/usr/bin/perl
use Math::BigInt;
$x = Math::BigInt->from_hex( "-3E8" );
print ( "$x\n" );
$x = Math::BigInt->from_hex( "-D75A" );
print ( "$x\n" );
|
Last Updated :
09 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...