Home > Articles > Web Development > Perl

  • Print
  • + Share This
This chapter is from the book


  1. The output of the Interest program looks sloppy. How do I control how many digits are displayed?

  1. The easiest way to control the number of decimal digits is to use the printf function, which is covered in Hour 9, "More Functions and Operators."

  1. Does Perl have a function for rounding?

  1. The printf function usually does what you want for rounding when displaying numbers. If you really need the round function, check out the POSIX module, which has this function and many more.

  1. How large (or small) of a number will Perl let me manipulate?

  1. The answer depends on your operating system. A typical Intel Unix system's double-precision floating-point numbers can have more than 300 places in the exponent. This means you can manipulate numbers with 300 zeros to the right (or left) of the decimal point. Typically, however, large numbers have only 14 digits of precision.

  • + Share This
  • 🔖 Save To Your Account