Learning Perl on Win32 Systems

Learning Perl on Win32 SystemsSearch this book
Previous: 1.7 ExercisesChapter 2Next: 2.2 Numbers

2. Scalar Data

What Is Scalar Data?
Scalar Operators
Scalar Variables
Scalar Operators and Functions
<STDIN> as a Scalar Value
Output with print
The Undefined Value

2.1 What Is Scalar Data?

A scalar is the simplest kind of data that Perl manipulates. A scalar is either a number (like 4 or 3.25e20) or a string of characters (like "hello" or the Gettysburg Address). Although you may think of numbers and strings as very different things, Perl uses them nearly interchangeably, so we'll describe them together.

A scalar value can be acted upon with operators (like plus or concatenate), generally yielding a scalar result. A scalar value can be stored into a scalar variable. Scalars can be read from files and devices and written out as well.

Previous: 1.7 ExercisesLearning Perl on Win32 SystemsNext: 2.2 Numbers
1.7 ExercisesBook Index2.2 Numbers