Vlad Ciubotariu wrote:
> Awesome! Thanks to all.
> 
> vlad
> On Wed, 11 Apr 2007 17:53:07 -0400, Vlad Ciubotariu wrote:
> 
>> I have a feeling I've seen it in the pickaxe book but I can't seem to find
>> it again.
>>
>> Is there a way to write this differently?
>>
>> array = [ 'element1', 'element2', ...]
>>
>> In perl I could do
>>
>> @array = qw( element1 element2 ...)
>>
>> without the quotes.
>>
>> thanks
>> vlad
> 

Also note that you can use other delimiters besides { and }:
irb(main):002:0> %w| bob jack harry |
=> ["bob", "jack", "harry"]
irb(main):003:0> %w( bob jack harry )
=> ["bob", "jack", "harry"]
irb(main):005:0> %w[ bob jack harry ]
=> ["bob", "jack", "harry"]
irb(main):006:0> %w< bob jack harry >
=> ["bob", "jack", "harry"]
irb(main):007:0> %w@ bob jack harry @
=> ["bob", "jack", "harry"]
irb(main):010:0> %w! bob jack harry !
=> ["bob", "jack", "harry"]

The following don't work:

irb(main):004:0> %w) bob jack harry (
irb(main):005:0]

^C
irb(main):008:0> %www bob jack harry www
SyntaxError: compile error
(irb):8: unknown type of %string
%www bob jack harry www
    ^
         from (irb):8