use strict; use warnings; my $sentence = 'The quick brown fox jumped over the lazy dog'; print "$sentence \n"; my $substring = 'The quick.!*?fox'; print "$substring \n"; my $quoted_substring = quotemeta($substring); print "$quoted_substring \n"; $sentence =~ s/quick brown/$quoted_substring/; print "$sentence \n";