$to_replace='some_string'; $my_string=~ s/$to_replace/$better_data/;