Numbers
Learn about the representation of numbers in Perl.
We'll cover the following...
We'll cover the following...
Perl supports numbers as both integers and floating-point values.
We can represent them with scientific notation as well as in binary, octal, and hexadecimal forms:
Internal representation of different formats
The numeric prefixes 0b, 0, and 0x specify binary, octal, and hex notation. Be aware that a leading zero on an integer always indicates the octal
mode.
Note: Even though we can write floating-point values explicitly with perfect accuracy, Perl represents them internally in a binary format, like most programming languages. This representation is sometimes imprecise in ...