我有一个像这样的字符串:
$a = "Mike , Tree ";
我想将其反转为"Tree, Mike".
"Tree, Mike"
有什么功能可以做到这一点吗?
将绳子分成两根绳子,翻转它们,然后重新连接它们。
或者,使用正则表达式:
$a =~ s/(.+),(.+)/\2,\1/g;