in reply to How do I reverse a string or the words in a string?
This also works for reversing the order of words, but is trickier.
$str = 'hacker. Perl another Just'; ($revwords = $str) =~ s/(\S+)/reverse $1/ge; $revwords = reverse $revwords
|
---|
In Section
Seekers of Perl Wisdom