Lesson 7 | Substitution modifiers |
Objective | Use the s// operator and appropriate modifiers to replace one element with another in a file. |
m//
operator, the s//
operator also allows the use of modifiers:
Modifier | Meaning |
e |
evaluate the right side as an expression |
Perl g-Modifier |
replace globally; in other words, all occurrences |
i |
do case-insensitive pattern matching |
m |
treat the string as multiple lines |
o |
only compile the pattern once |
s |
treat the string as a single line |
x |
use pretty-printing extensions |
m//
operator. m//
operator.
s//
operator to replace all occurrences of one element in a file with another.