$s = 'Two words'; $s =~ s[(^\S+)(\s.*\s)(\S+$)][$3$2$1]; print $s; #Two words
Oops! ;-)
In reply to Re^4: How do I reverse the order of the first and last word of a string?
by Not_a_Number
in thread How do I reverse the order of the first and last word of a string?
by ferrispike12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |