Scalar Values and List Values

This section describes what is a scalar value, a single numeric value or a string of characters, and what is a list value, a list of scalar values.

Perl support only support two types of values: Scalar Value and List Value.

1. Scalar Value - A single value with two sub types: Numeric Scalar Value and String Scalar Value .

• Numeric Scalar Value - A scalar value that can be used as an operand for arithmetic operations. For example, 0, 3.14, 9.99, and 2.99792458e8 are numeric values.
• String Scalar Value - A scalar value that represents a string (a sequence of characters). For example, "A", "Hello world!", and "2.99792458e8" are string values.

2. List Value - An ordered list of scalar values. Individual scalar values in a list value are called elements of the list value. An element can be identified by its ordered position in the list. Numeric scalar values and string scalar values can be mixed in a single list value.

For example, ("Sun","Mon","Tue","Wed") is a list value with 4 elements. The first element (identified by position 0) is the string scalar value "Sun". The second element (identified by position 1) is the string scalar value "Mon".

Another example, ("PI", 3.14, "Price", 9.99) is a list value with 4 elements mixed with both string scalar values and numeric scalar values. The first element (identified by position 0) is the string scalar value "PI". The second element (identified by position 1) is the numeric scalar value 3.14.