On Sun, Sep 11, 2011 at 9:58 AM, Zipizap zipizap <zipizap123 / gmail.com>wrote:

>
> # B- The same using %w - it splits a string into words, and returns an
> array. Notice also that () is used to delimit the string, instead of ""
> str_arr = %w(boy girl cat dog)   # => ["boy", "girl", "cat", "dog"]
>
>
The delimiters are arbitrary, so you can use quotes if you want.

%w"boy girl cat dog" # => ["boy", "girl", "cat", "dog"]


On Sun, Sep 11, 2011 at 9:00 AM, Joe Collins <joec_49 / hotmail.com> wrote:

> Also, I want to read words from a file and make them an array of
> strings. I can read files fine but making an array of strings is where I
> am
> stumped.
>
>
My answer would change depending on some variables like how big your file is
and whether the words are each on their own line or if there is one line
with spaces between each, or if there are lots of lines with lots of words
one each, so might be beneficial to provide more information.