Variables
Learn how variables work in Perl and about the relationships between variable types, sigils, and context.
We'll cover the following...
A variable in Perl is a storage location for a value. It can be our aunt’s name and address or the distance between our office and a golf course on the moon. While a trivial program may manipulate values directly, most programs work with variables. Think of this like algebra: we manipulate symbols to describe formulas. It’s easier to explain the Pythagorean theorem in terms of the variables a
, b
, and c
than by intuiting its principle by producing a long list of valid values.
Variable scopes
Our ability to access a variable within our program depends on the variable’s