DavidSzczesniak
12/4/2017 - 3:12 PM

Global Matching and Substitution

This allows your script to work through the whole text and not stop at the first match found.

# All that's required is a "g" at the end

# Examples:

# Match all instances of "Harry Potter" in the text
my $story =~ m/Harry Potter/g;

# Substitute all instances of "Harry Potter" with "Larrt Wall"
my $story =~ s/Harry Potter/Larry Wall/g;