my $string = 'Some text with $ signs in it'; my $pattern = '$ signs'; $string =~ s/$pattern/dollar signs/; print "$string\n"