use warnings; use strict; my $test = "Here is the there"; $test =~ s{(ther.)}{$1}ig; print "$test\n"; __END__ Here is the there