"Jamis Buck" <jgb3 / email.byu.edu> schrieb im Newsbeitrag
news:3FD8F5A5.7040607 / email.byu.edu...
> Thomas Adam wrote:
>
> >vthread << File.new(pathname,
> >"r").readlines().to_s().grep(/^foobar/).uniq()
> >
> >
>
> The << operator for array only appends the single object given to the
> end of the array--it does not concatenate one array onto another.  What
> you probably want is the += operator:
>
>   vthread += File.new(...).grep(/^foobar/).uniq()

Not good: this creates new arrays all the time.  Also: File.readlines is
better since it closes the file automatically:

vthread.push *File.readlines(pathname).grep(/^foobar/).uniq()
or
vthread.concat File.readlines(pathname).grep(/^foobar/).uniq()

Kind regards

    robert