From: saurabh purnaye Date: 2009-02-13T23:12:44+09:00 Subject: Re: Meaning of "<<"? --000e0cd147f298bc8f0462cd7328 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Chris, If you see the string class documentation of ruby, http://www.ruby-doc.org/core/classes/String.html#M000822 Its for concatenation.. You may find more here http://www.ruby-doc.org/ On Fri, Feb 13, 2009 at 7:33 PM, Chris Davies wrote: > Hi, > > I'm currently trying to learn ruby, coming from a perl/unix > background. I've been working through one of the many online tutorials > and it's suddenly thrown in the "<<" operator. > > Now, I'm familiar with a the use of "<<" as a bitwise left shift > and as a here doc, but this one throws me. The relevant URL is > http://rubylearning.com/satishtalim/mutable_and_immutable_objects.html > and here's a variation on the theme for illustrative purposes: > > str = 'one' > str << 'two' > puts str # onetwo > > It seems to me that << in this context is equivalent to +=, but I can't > find any documentation explaining /why/ this is the case, and why I > should use one in preference to the other. (Google really doesn't like > "<<".) > > Any suggestions, please? > Cheers, > Chris > > -- -- Thanks and Regards Saurabh Purnaye +91-9922071155 skype: sorab_pune yahoo & gtalk: saurabh.purnaye msn: psaurabh@live.com --000e0cd147f298bc8f0462cd7328--