Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Table 3.3 shows the major syntax variations for the matching operator, which provides the foundation for Perl’s pattern-matching capabilities.
| Form[a] | Meaning | Explanation |
|---|---|---|
| /RE/ | Match against $_ | Uses default “/” delimiters and the default target of $_ |
| m:RE: | Match against $_ | Uses custom “:” delimiters and the default target of $_ |
| string =~ /RE/ | Match against string | Uses default “/” delimiters and the target of string |
| string =~ m:RE: | Match against string | Uses custom “:” delimiters and the target of string |
[a] RE is a placeholder for the regex of interest, and the implicit $_ or explicit string is the target for the match, which provides the data for the matching operation.