next up previous contents
Next: Operators for String Scalar Up: Introduction to Perl Programming Previous: System Variables   Contents

Scalar Data

Scalar data are characterized by the fact that they contain a single value. Thus, they are the building blocks of any information that your perl program will store or manipulate. There are two main types of scalar data in perl: string and numeric. A third type, known as a reference, is generally only used when you are working with complex data structures.

Scalar data, both string and numeric, are stored in variables which begin with a dollar sign ($). Perl will convert strings to numbers and vice versa whenever it's completely clear what that means. One place where it's not clear is when you compare two things, so, as explained in Section 3.4, you should make sure that you use the correct operator when comparing two values.


Phil Spector 2002-10-18