in reply to How do I print/round a number to a given number of decimal places?

sub stround { my( $number, $decimals ) = @_; substr( $number + ( '0.' . '0' x $decimals . '5' ), 0, $decimals + + length(int($number)) + 1 ); }
TIMTOWTDI!

  • Comment on Re: How do I print/round a number to a given number of decimal places?
  • Download Code