Scalar Variables and Operators
Scalar Variables
- Up to this point we have been looking only at Literals
. Certainly important, but of limited utility for a dynamic
program.
- A Perl Variable , like variables in other languages, is
simply a symbolic representation of a storage location to be
manipulated.
- Perl scalar variables begin with a $ symbol,
followed with a letter, followed by more letters, digits, or
underscores. Variable names are case sensitive.
- Example: $Hello_There
- Example: $All4One
- Example: $x
- Remember Perl does not care if it is a numeric scalar, or a
string scalar. This is very unusual compared to other
languages, and it is remarkable how few problems it creates, and how
many problems it solves.
Back to Syllabus
Previous: Converting between numbers and
strings
Next: Scalar Operators and Functions