You may want to fix that to properly handle punctuation and capitalization:
$_ = 'This is the word.'; $_ =~ s[(^\w+)(\s.*\s)(\w+)([[:punct:]]?)$][\u$3$2\l$1$4]; print
--
print "Just Another Perl Adept\n";
In reply to Re^4: How do I reverse the order of the first and last word of a string?
by vrk
in thread How do I reverse the order of the first and last word of a string?
by ferrispike12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |