Yes, I think this is a bigint bug:
#! perl
use strict;
use warnings;
use bigint;
my $m = '10';
my $k = '2';
++$k;
print $m / $k, "\n";
print $k->sign(), "\n";
Output:
13:45 >perl 992_SoPW.pl
3.33333333333333
Can't locate object method "sign" via package "3" (perhaps you forgot
+to load "3"?) at 992_SoPW.pl line 10.
13:45 >
This shows that ++ is failing to convert $k into a BigInt object. But change the line ++$k; to $k += 1; and the output is now as expected:
13:45 >perl 992_SoPW.pl
3
+
13:46 >
The documentation for bigint claims:
All operators (including basic math operations) except the range operator .. are overloaded.
But this doesn’t appear to be true for autoincrement.
Hope that helps,
|