next up previous contents
Next: The Matching Operator (m//) Up: Regular Expressions Previous: Setting the Target Operator


We may frequently need to change a pattern in a string. The substitution operator (s) is the simplest form of substitution. It has the form:


So to replace the + characters from CGI input with a space we could do:

$CGI_in_val =~ s/\+/ /ge;

We can qualify the substitution with a g global substitution, i ignore case and e evaluate right side as expression and others.