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.  I 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.  But I just don't seem to get
> it right.
> 
> My code right now is as follows:
> 
> emails = File.open("/users/lem/desktop/test/
> POCs_DNB.txt","r").readlines.map! {|x| x.chomp}  
>
> email.scan(/\S+/)  

scan() returns an array.  You 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
> 
> "foo1 / bar.edu\foo2 / bar.com\foo3 / bar.gov......"
> 

Nowhere in the code you posted does a variable named email exist.


> 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.

-- 
Posted via http://www.ruby-forum.com/.