From: Dominik Honnef Date: 2010-06-14T04:00:20+09:00 Subject: Re: Idiomatic Printing an array with commas Chuck Brotman writes: > Hi, > > I want to print an array (of strings, mostly) with commas separating the > elements (so it would look like the result in the irb [snip] > > Is there a nice ruby idiom to do what I want (or to simply produce the > necessary string for printing? a = ["one", "two", "three"] puts a.inspect puts "[" + a.join(", ") + "]" # >> ["one", "two", "three"] # >> [one, two, three]