my $boring_string = '...when I want to keep most of the string...'; (my $exciting_string = $boring_string) =~ s/(keep)/$1/;