Reference Basics

You create and assign a normal scalar variable by using an assignment operator, as follows:

$a="Stones";   # A normal scalar

After this snippet, a scalar variable called $a is created, and it contains the string "Stones". Now, somewhere within the computer's memory, there is a place labeled $a that contains that string, as illustrated here:

If you were to assign the scalar $a to $b—like $b=$a;—you would wind up with two copies of the data, withtwo different names, as shown here:

Having two copies might be acceptable if you want ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.