Let’s say I have string ‘The quick brown fox jumps over the lazy dog’ can I change this to ‘The slow brown fox jumps over the energetic dog’ with one regular expression? Currently, I use two sets of regular expressions for this situation. (In this case, I use s/quick/slow/ followed by s/lazy/energetic/.)
Let’s say I have string The quick brown fox jumps over the lazy dog
Share
The second part of a substitution is a double quoted string, so any normal interpolation can occur. This means you can use the value of the capture to index into a hash: