On Tuesday, January 21, 2003, 12:38:24 AM, Jim wrote: > Hi: > I was wondering, to create an array I usually do %w{a b c} #=>> ["a", "b", "c"] > Is there a built-in way to do this and get symbols? > For example: %w{:a :b :c} #=>> [:a, :b, :c] > or given a mixed list %w{:a b :c} #=>> [:a, "b", :c] If there were a built-in way to do this, I'm sure we'd both know about it. It's easy to write a method to do it, of course. But you knew that. class Array def to_sym map { |e| s = e.to_s if s[0] == ?: s[1..-1].intern else s end } end end %w{:a b :c}.to_sym # => [:a, "b", :c] Gavin