( my $final_string = $str_with_dash ) =~ s| ( [^.-] ) | $str_no_dash =~ / ( . ) /xsg && $1 |xeg;