in reply to Print Number With Implied Decimal Point
Regular expressions should work.
Alternatively, try Math::BigFloat.
use 5.010; use Math::BigFloat; my $number = "999999999999999999999900"; my $decimal_places = 2; Math::BigFloat->precision(-$decimal_places); say Math::BigFloat->new($number)/(10**$decimal_places); __END__ 9999999999999999999999.00
substr will be faster though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print Number With Implied Decimal Point
by Eliya (Vicar) on Apr 18, 2012 at 14:51 UTC |