From: Ben Lovell Date: 2009-05-26T02:28:09+09:00 Subject: Re: hash assignment [:x] vs ['x'] --001636c5a537e79ef8046abfeec5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, May 25, 2009 at 6:19 PM, Mk 27 wrote: > Being totally new to ruby, I just noticed that using > > bob['phone'] > > which coming from perl is a style I'm used to, results in a separate key > than > > bob[:phone] > > That seems slightly weird, I had assumed the :form is just a shorthand > like %w( ). So -- is there anything more that I need to understand > about this distinction? The first example is indexing via a string, the second is via a ruby symbol. You can think of a symbol as essentially a (very) lightweight string usually used for keying into hashes and general naming of things. Rgds, Ben --001636c5a537e79ef8046abfeec5--