Chapter 2. Scalar DataContents: What Is Scalar Data? 2.1. What Is Scalar Data?In English, as in many other spoken languages, we're used to distinguishing between singular and plural. As a computer language designed by a human linguist, Perl is similar. As a general rule, when Perl has just one of something, that's a scalar.[40]
A scalar is the simplest kind of data that Perl manipulates. Most scalars are either a number (like 255 or 3.25e20) or a string of characters (like hello[41] or the Gettysburg Address). Although you may think of numbers and strings as very different things, Perl uses them nearly interchangeably.
A scalar value can be acted upon with operators (like addition 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 can be written out as well. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|