珀尔 | Math::BigInt->config() 方法
Perl 中的Math::BigInt
模块提供了表示具有任意精度和重载算术运算运算符的整数的对象。
Math::BigInt
模块的config()方法用于获取 Perl 模块的配置信息。
Syntax: Math::BigInt->config()
Parameter: None
Returns: a hash containing the configuration, e.g.class name, the version number, library, etc.
示例 1:
#!/usr/bin/perl
# Import Data Dumper Module
use Data::Dumper;
# Import Math::BigInt module
use Math::BigInt;
print Dumper(Math::BigInt->config());
print Math::BigInt->config()->{version}, "\n";
输出:
$VAR1 = {
'precision' => undef,
'upgrade' => undef,
'accuracy' => undef,
'div_scale' => 40,
'trap_nan' => 0,
'lib_version' => '1.9997',
'trap_inf' => 0,
'version' => '1.9997',
'round_mode' => 'even',
'lib' => 'Math::BigInt::Calc',
'class' => 'Math::BigInt',
'downgrade' => undef
};
1.9997
示例 2:
#!/usr/bin/perl
# Import Data Dumper Module
use Data::Dumper;
# Import Math::BigInt module
use Math::BigInt;
print Dumper(Math::BigInt->config());
print Math::BigInt->config()->{lib}, "\n";
输出:
$VAR1 = {
'lib' => 'Math::BigInt::Calc',
'class' => 'Math::BigInt',
'accuracy' => undef,
'upgrade' => undef,
'round_mode' => 'even',
'div_scale' => 40,
'trap_nan' => 0,
'lib_version' => '1.9997',
'version' => '1.9997',
'precision' => undef,
'trap_inf' => 0,
'downgrade' => undef
};
Math::BigInt::Calc