Capture the two strings to be swapped using a regex then put them back together in opposite order:
$origin =~ s/\( ([^ ,]+) \s*,\s* ([^ )]+) \) /($2 $1)/x;
Note that the /x allows the spaces to be used to break up the expression for easier understanding.
In reply to Re: Swapping two parts of a string
by GrandFather
in thread Swapping two parts of a string
by Harch84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |