From: "Suraj N. Kurapati" Date: 2006-05-10T13:27:21+09:00 Subject: Re: short hand %w -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Corey wrote: > Corey wrote: >> how come when i do this m = %w[cat [dog dog] mouse] and then request >> m[1] instead of giving me ["dog", "dog"] it gives me "[dog" >> >> do i have to use the shorthand %w for the inner array too? > > i tride it on the inner array and it return %w"[dog" so that doesnt > work, the %w doesnt seem to work accros the board the way i thought it > would. As mentioned a few weeks ago on this list, you must escape whitespace within a single "word" using backslashes (a convention of UNIX shells, AFAIK): irb(main):003:0> %w(cat dog\ dog mouse) => ["cat", "dog dog", "mouse"] irb(main):004:0> %w(cat dog\ dog mouse this\ is\ \ \ a\ long\ phrase) => ["cat", "dog dog", "mouse", "this is a long phrase"] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEYWuamV9O7RYnKMcRAtEuAJ960nSEOXSqhVVATiCkkMeSOzD80ACeI8NI cX5/sgIC+1KaCjYe3NTH5Gs= =bbpe -----END PGP SIGNATURE-----