> $string =~ s/$pattern/$replace/g;

$string =~ s/$pattern/$replace/gx;