develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000316.002] Math::BigInt and string ops

From:
Unknown Sender
Date:
March 16, 2000 14:21
Subject:
Re: [ID 20000316.002] Math::BigInt and string ops
Message ID:
20000316232102.A3558@noris.de
Hi,

> >Is it the s/^\+// that's broken?
> No, it's that if you try to initialize a bigint to "0.5", you get

Sorry -- different problem.

I wasn't trying to initialize a bigint to 0.5. Consider this:

$ perl -MMath::BigInt
$obj = new Math::BigInt 123456;
print "$obj\n"
$obj =~ s/^+//;
print "$obj\n",ref($obj),"\n";
^D

yields:
+123456
+123456
[ empty line ]

Thus, $obj is no longer a Math::BigInt object (which is to be expected),
BUT the substitution hasn't happened. There's some weird interaction with
overlaid '""' which in effect trashes the result of s/// in this case.

-- 
Matthias Urlichs  |  noris network GmbH   |   smurf@noris.de  |  ICQ: 20193661
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
HENPECKED HUSBAND:
       One who's afraid to tell his pregnant wife that he's sterile.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About