On Feb 4, 9:07=A0pm, 7stud -- <bbxx789_0... / yahoo.com> wrote:
> Lovell Mcilwain wrote:
> > Hello all,
>
> > I am trying to get a file into an array using .scan and I can't seem
> > to get anything to work properly.
>
> > I am reading in a file of email addresses (1 per line) and it all
> > seems to come in as 1 long string some how. =A0I am trying to use scan
> > to break it up into an array of emails so that I can do some uniq
> > checks and validation with other arrays. =A0But I just don't seem to get=

> > it right.
>
> > My code right now is as follows:
>
> > emails =3D File.open("/users/lem/desktop/test/
> > POCs_DNB.txt","r").readlines.map! {|x| x.chomp} =A0
>
> > email.scan(/\S+/) =A0
>
> scan() returns an array. =A0You don't assign the array to any variable, so=

> it is discarded.
>
>
>
> > When I did an inspect on the email variable The address appeared as
> > such
>
> > "f... / bar.edu\f... / bar.com\f... / bar.gov......"
>
> Nowhere in the code you posted does a variable named email exist.

Very first line of my code is what I thought to be a variable...
>
> > This is my absolute first time working with .scan and regular
> > expressions so I have a little bit of a learning curve with this one.
>
> > Any help is greatly appreciated.
>
> If you expect to get relevant help, you should post a short example
> progrram that demonstrates your problem, i.e. an example program that
> anyone can run and get the same results you do.

The code I posted is exactly what I ran aside for giving you
hundrededs of lines of email.  The example is exactly what I ran to
get the results I posted.
>
> --
> Posted viahttp://www.ruby-forum.com/.