$text1 = 'A company (IBM) made a profit of $300 in the current year.'; $text2 = 'Latest profit news: A company (IBM) made a profit of $300 in the current year. This is 180% more than in the last year.'; #### $text2 =~ s/($text1)/FOO$1BAR/;