$text = 'Cheese.Bacon'; $v1 = '(\w+)\.(\w+)'; $v2 = '$2\.$1'; $test =~ s/$v1/$v2/; #### $text = 'Bacon.Cheese'; #### $text = '$2\.$1';
## $text = 'Bacon.Cheese'; ##
## $text = '$2\.$1';