What’s a variable?

A variable is a placeholder for information within a Perl script.

In Perl, a Scalar variable is a single piece of information. It always starts with a dollar sign ($).

Example: $myname

An Array variable is a list of information. It always starts with the “at” sign (@).

Example: @months

Variables are essential to all programming, and very useful. For example, you can use a Scalar variable to easily change “brown eyes” to “blue eyes” in a Perl script:

$eyecolor=“brown”

As the old song says, “Don’t it make my $eyecolor eyes blue...”