Q&A

Q1:The output of the Interest program looks sloppy. How do I control how many digits are displayed?
A1: 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.”
Q2:Does Perl have a function for rounding?
A2: 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.
Q3:How large (or small) of a number will Perl let me manipulate?
A3: 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 ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.