Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Perl as a (better) grep command > Working with the matching operator

3.3. Working with the matching operator

Table 3.3 shows the major syntax variations for the matching operator, which provides the foundation for Perl’s pattern-matching capabilities.

Table 3.3. Matching operator syntax
Form[a]MeaningExplanation
/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 stringUses default “/” delimiters and the target of string
string =~ m:RE:Match against stringUses 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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial