From: botp Date: 2010-12-29T16:01:48+09:00 Subject: Re: What am I missing about splat operator? On Wed, Dec 29, 2010 at 10:50 AM, RichardOnRails wrote: > In trying to understand the splat operator, I visited: > http://theplana.wordpress.com/2007/03/03/ruby-idioms-the-splat-operator/ > > The first example that site offers is: >   The split mode : >   pet1, pet2, pet3 = *["duck","dog","cat"] > > That resulted in pet1 == "duck", etc > > But so did: >   pet1, pet2, pet3 = ["duck","dog","cat"] # no splat operator > and# >   pet1, pet2, pet3 = "duck","dog","cat" # no array-literal markers > > So this first example makes no sense, does it? The splat operator is more explicit and versatile. try the ff x,*y,z=*[1,2,3,4,5], 100,200 also, some methods that do not accept array argument is just a splat away, eg printf("%d %d %d",*[1,2,3]) best regards -botp