Chapter 8. Regular Expressions—Pattern Matching
By the end of this chapter, you should understand the following Perl code:
while(<DATA>){ ($name,$price)=split(":"); $price =~ s/$price/$& + ($& * .20)/e; printf "%s \$%.2f\n",$name, $price if $price > 35;}_ _DATA_ _Ramya:30.25Lu:12.66Shiva:65.75Dee:44.32
8.1 What Is a Regular Expression?
This is a regular expression: /love/. This is also a regular expression: /^.+$/.
A regular expression (regex) is really just a sequence, or pattern, of characters that is matched against a string of text when performing searches and replacements. Regexes have been around for ...
Get Perl by Example 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.