If you are familiar with UNIX utilities, such as vi, sed, grep, and awk, you have met face-to-face with the infamous regular expressions and metacharacters used in delimiting search patterns. Well, with Perl, they're back!
What is a regular expression, anyway? A regular expression is really just a sequence, or pattern, of characters that is matched against a string of text when performing searches and replacements. A simple regular expression consists of a character or set of characters that matches itself. The regular expression is normally delimited by forward slashes.[1] The special scalar $_ is the default search space where Perl does its pattern matching. $_ is like a shadow. Sometimes you see it; sometimes you don't. Don't worry; all this will become clear as you read through this chapter.
[1] Actually, any character can be used as a delimiter. See Table 8.1 on page 210 and Example 8.12 on page 211.
1 /abc/ 2 ?abc? Explanation
|