Perl Data Types

Before going on, let me point out the main data types used in Perl: literals, variables (including strings, arrays, and hashes), code references, filehandles, and here-documents. Each of these is given brief descriptions and examples in the following sections.

Literals

Literals are actual values—literally, what they are. There are numeric literals (for example, 1, 2, 3, 4, and so on) and string literals (abc, xyz, Fred, Sylvia, and so on). Some characters are not literals but are metacharacters or regular expression wild-cards. These characters match something other than themselves. The metacharacters are \ | ( ) [ ] { } ^ $ * + ?.

An important metacharacter to understand is the backslash (\), which turns a metacharacter into ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.