si_lence has asked for the wisdom of the Perl Monks concerning the following question:
The output is:use strict; use warnings; use Data::Dumper; use bignum(a=>200); my $s = sqrt(2);; print Dumper(\$s); for my $num (2..2) { $s = sqrt($num); print Dumper(\$s); }
It looks as if the blessing of $s is lost in the loop, but I don't understand why. si_lence (confused) Update: Thanks everybody for pointing out the reason and the suggestions. I did read the documentation, but obviously glossed over the important part.$VAR1 = \bless( { '_es' => '-', '_m' => [ 605715, 1152782, 9995050, 5927557, 5927505, 1322266, 9358314, 1497099, 1264412, 8507372, 4836055, 9702492, 2309122, 5013846, 4157273, 5343276, 8850387, 6210703, 7324784, 9737990, 7317667, 3769480, 9671875, 9807856, 7242096, 8801688, 7309504, 2135623, 1414 ], '_a' => 200, '_e' => [ 199 ], 'sign' => '+' }, 'Math::BigFloat' ); $VAR1 = \'1.4142135623731';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 'use bignum' scoping question
by lamprecht (Friar) on Jan 10, 2010 at 23:00 UTC | |
by ikegami (Patriarch) on Jan 11, 2010 at 01:02 UTC | |
|
Re: 'use bignum' scoping question
by syphilis (Archbishop) on Jan 10, 2010 at 23:17 UTC | |
|
Re: 'use bignum' scoping question
by Anonymous Monk on Jan 10, 2010 at 23:02 UTC |