A Number in Perl is a mathematical object used to count, measure, and perform various mathematical operations. A notational symbol that represents a number is termed as a numeral. These numerals, in addition to their use in mathematical operations, are also used for ordering(in the form of serial numbers).
Examples:
1, 2, 4, 5.6, 7.9, 057, 1.67e10, 0xFFFF
These numbers as per their use can be categorized into various types:
 Integers: Perl integers are represented as decimal number with base 10. These numbers can be positive and negative both. However, Perl uses “_” to represent big integer numbers to increase readability.
Example: 123,154,454 is represented as 123_154_454
#!/usr/bin/perl
# Positive Integer
$x
= 20;
# Negative Integer
$y
= 15;
# Big Integer Number
$z
= 123_154_454;
# Printing these numbers
print
(
"Positive Integer: "
,
$x
,
"\n"
);
print
(
"Negative Integer: "
,
$y
,
"\n"
);
print
(
"Big Integer: "
,
$z
,
"\n"
);
chevron_rightfilter_noneOutput:
Positive Integer: 20 Negative Integer: 15 Big Integer: 123154454
 Floating Numbers:
Floating point numbers in Perl are those which contain integer as well as fractional values separated by a decimal point. The integer part of a Floating Number could be positive or negative both but the fractional value can only be a positive value. Floating Numbers in Perl can be represented in two ways: Fixed Point: In this representation decimal point is fixed. This decimal point denotes the starting of the fractional part.
Example: 12.5678
 Scientific: This representation consists of two parts, significand which represents the actual number and exponent which represents the power of 10 with which the significand is multiplied.
Example: 1.23567e3 represents 1235.67
#!/usr/bin/perl
# Positive Floating Number
$x
= 20.5647;
# Negative Floating Number
$y
= 15.2451;
# Scientific value
$z
= 123.5e10;
# Printing these numbers
print
(
"Positive Number: "
,
$x
,
"\n"
);
print
(
"Negative Number: "
,
$y
,
"\n"
);
print
(
"Scientific Number: "
,
$z
,
"\n"
);
chevron_rightfilter_noneOutput:Positive Number: 20.5647 Negative Number: 15.2451 Scientific Number: 1.235e08
 Fixed Point: In this representation decimal point is fixed. This decimal point denotes the starting of the fractional part.

Hexadecimal Numbers
Hexadecimal numbers are numbers with base 16 i.e. they range from 015 represented as 0xa with ‘0x’ preceding the number whereas ‘a’ here is the value of 10 in Hex form. These alphabets range from ‘a’ to ‘f’ representing 10 to 15. Hexadecimal numbers can be both negative and positive.Example: 0xe represents 14 in Hex and 0xc represents 12
#!/usr/bin/perl
# Positive Hexadecimal Number
$x
= 0xc;
# Negative Hexadecimal Number
$y
= 0xe;
# Printing these values
print
(
"Positive Hex Number: "
,
$x
,
"\n"
);
print
(
"Negative Hex Number: "
,
$y
,
"\n"
);
# To print Hex value
printf
(
"Value in Hex Format: %x"
,
$x
);
chevron_rightfilter_noneOutput:Positive Hex Number: 12 Negative Hex Number: 14 Value in Hex Format: c
Hence, to print value of the number in Hexadecimal format, ‘%x’ is used as shown above.
 Octal Numbers
Octal numbers are the numbers with base 8 i.e. they range from 07. These numbers are represented as 057 with ‘0’ preceding the number and the rest part is the octal value of the required decimal number. Just like other types, octal numbers can also be negative as well as positive.Example: For octal number 057 the decimal equivalent will be 47.
#!/usr/bin/perl
# Positive Octal Number
$x
= 074;
# Negative Octal Number
$y
= 074;
print
(
"Positive Octal number: "
,
$x
,
"\n"
);
print
(
"Negative Octal number: "
,
$y
,
"\n"
);
# To print value in Octal Form
printf
(
"Value in Octal Form: %o"
,
$x
);
chevron_rightfilter_noneOutput:Positive Octal number: 60 Negative Octal number: 60 Value in Octal Form: 74
Here, ‘%o’ is used to print the value in its octal form
 Binary Numbers
Binary numbers are number with base 2 i.e. they are formed of only two values 0 and 1. These numbers are represented as 0b1010 with ‘0b’ preceding the number.
Example: For binary number ‘0b1010′ the decimal equivalent will be ’10’.#!/usr/bin/perl
# Positive Binary Number
$x
= 0b1010;
# Negative Binary Number
$y
= 0b10110;
# Printing these values
print
(
"Positive Binary Number: "
,
$x
,
"\n"
);
print
(
"Negative Binary Number: "
,
$y
,
"\n"
);
# Printing in unsigned binary form
printf
(
"Value in unsigned Binary Form: %b"
,
$x
);
chevron_rightfilter_noneOutput:Positive Binary Number: 10 Negative Binary Number: 22 Value in unsigned Binary Form: 1010
In the above code, ‘%b’ is used to print the number in its actual binary form.
Recommended Posts:
 Perl List and its Types
 Perl  Variables and its Types
 Perl  Data Types
 Perl Tutorial  Learn Perl With Examples
 Perl  Basic Syntax of a Perl Program
 Number Guessing Game using Perl
 Perl  Getting the Number of Elements of an Array
 Perl  Automatic String to Number Conversion or Casting
 Number and its Types in Julia
 Difference between fundamental data types and derived data types
 Perl vs C/C++
 Perl  int() function
 Perl Hash
 Perl  last in loop
 Perl  sin() Function
 Perl  tell() Function
 Perl  abs() function
 Perl  each() Function
 Recursion in Perl
 Perl  givenwhen Statement
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.