<?xml version="1.0" encoding="windows-1252"?>
<node id="996030" title="Math::BigInt new" created="2012-09-27 11:25:22" updated="2012-09-27 11:25:22">
<type id="115">
perlquestion</type>
<author id="294463">
QM</author>
<data>
<field name="doctext">
[cpan://Math::BigInt] &lt;code&gt;new&lt;/code&gt; does something funny when creating a new object from an existing &lt;code&gt;Math::BigInt&lt;/code&gt; object:
&lt;code&gt;
#!perl
use strict;
use warnings;

use Math::BigInt;

my $x = new Math::BigInt 27; 
my $y = $x-&gt;new(44); # this is the funny bit
my $z = Math::BigInt-&gt;new(99);
exit;
&lt;/code&gt;
&lt;br&gt;
From the debugger, this is what &lt;code&gt;$y&lt;/code&gt; is:
&lt;code&gt;
  DB&lt;1&gt; x $y
0  27=HASH(0x14f15ac)
   'sign' =&gt; '+'
   'value' =&gt; ARRAY(0xbc9cd4)
      0  44
&lt;/code&gt;
&lt;br&gt;
Why is the class now '27'? And a &lt;code&gt;print&lt;/code&gt; on &lt;code&gt;$y&lt;/code&gt; gives:
&lt;code&gt;
  DB&lt;2&gt; p $y
27=HASH(0x14f15ac)
&lt;/code&gt;
&lt;br&gt;
While the 'value' is right, any further operations with &lt;code&gt;$y&lt;/code&gt; are wrong.
&lt;p&gt;
&lt;b&gt;Update:&lt;/b&gt; Bug reported [rt://79902|here].
&lt;div class="pmsig"&gt;&lt;div class="pmsig-294463"&gt;
&lt;p&gt;-QM&lt;br /&gt;
--&lt;br /&gt;
Quantum Mechanics: The dreams stuff is made of
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
