Recipe 1.4. Reversing a String by Words or Characters_RubyRecipe 1.4. Reversing a String by Words or Characters_Ruby_02Code
 1 s=".sdrawkcab si gnirts sihT"
 2 puts s.reverse #This string is backwards.
 3 puts s #.sdrawkcab si gnirts sihT
 4 s.reverse!  
 5 puts s #This string is backwards.
 6 
 7 puts "Three little words".split(/\s+/)
 8 #Three
 9 #little
10 #words
11 
12 puts "Three little words".split(/(\s+)/)
13 #Three
14 #
15 #little
16 #
17 #words
Because the regular expression /(\s+)/ includes a set of parentheses, the separator strings themselves are included in the returned list.