From: Daniel Lucraft Date: 2007-06-06T20:08:24+09:00 Subject: Re: efficient regex scanning Trochalakis Christos wrote: > Hello there, > > The problem with this code is that it stores all the words in an array > which is not so good in terms of efficiency. > Is there a better way to do it? > Something like IO.read(file).each_scan { foo } > > Thanks > Christos Does just using a block with scan do what you need? IO.read(file).scan(/\w+/) { |word| f.print word } http://www.ruby-doc.org/core/classes/String.html#M000827 best, Dan -- Posted via http://www.ruby-forum.com/.