in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
perl5 version without join -
sub reverseWords { "@{[reverse split' ',shift]}" }
<update>
and without split -
sub reverseWords { "@{[reverse shift=~/\S+/g]}" }
</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In Section
Meditations