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