Variables

Learn how variables work in Perl and about the relationships between variable types, sigils, and context.

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.

Get hands-on with 1200+ tech skills courses.