From: "David A. Black" Date: 2009-06-24T21:34:10+09:00 Subject: Re: Noob question on strings Hi -- On Wed, 24 Jun 2009, Fredrik Ludvigsen wrote: > Would anyone care to explain what happens when the following is > executed? (I already know what gets printed, but not why...) > > print <<-STRING1, <<-STRING2 > Concat > STRING1 > enate > STRING2 > > > I'm sorry if it has been answered before, but I didn't know just what to > search for in the forum... You're asking for two strings to be printed. The first is specified as "everything starting on the next line and ending at the first occurrence of 'STRING1' on a line by itself, without including that line". That's what <<-STRING1 means. The second is similarly specified with regard to the string 'STRING2', but starts after the STRING1 string has already consumed the "Concat" line. This construct is called a "here-document". You've come up with a fairly arcane use of it :-) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) "Ruby 1.9: What You Need To Know" Envycasts with David A. Black http://www.envycasts.com