Perl language is a loosely typed language, the Perl interpreter itself chooses the data type. Hence, there is no need to specify data type in Perl programming.
There are basically three data types in Perl:
In Perl there are two different types of scalar constants:
Perl numeric literals are numbers. Perl stores number internally as either signed integers or floating-point values.
Perl numeric literals can be assigned following types of formats:
|5_549_63||A large number|
Look at the above table,
Perl string literals contain an empty string, ASCII text, ASCII with high bits or binary data. There is no limit in a string to contain data. They are surrounded by either a single quote (′) or double quote (″).
Variable interpolation is allowed in double quote string but not in single quote string. Also special characters preceding with backslash (\) are supported by double quote strings only.
Escape Characters in string literals
|\r||Denotes carriage return|
|\ t||Denotes horizontal tab|
|\v||Denotes vertical tab|
|\Q||Backslash following all non-alphanumeric character|
|\f||Denotes form feed|
|\u||Change next character to uppercase|
|\U||change all following characters to uppercase|
|\l||Change next character to lowercase|
|\L||Change all following character to lowercase|
|\E||Denotes \U, \L, \Q|
|\cX||Controls characters, X is a variable|
|\0nn||Create octal formatted numbers|
|\xnn||Create hexadecimal formatted numbers|
|\'||Denote single quote|
|\"||Denote double quote|