James Gray wrote: > On Mar 10, 2006, at 5:28 PM, William James wrote: > >> File.open("wordlist") { |f| >> while w = f.gets >> puts w if w.size==11 && w.split(//).uniq.size == 11 >> end >> } > > That's what the foreach() iterator is for: > > File.foreach("wordlist") do |word| > puts word if word.chomp.split("").uniq.size == 10 > end > > James Edward Gray II James: This code doesn't work on my Mac. I do have a version that uses the file block and each/foreach above, but I'm suspecting that when the string becomes an array after the split something's breaking down as I get words of all sizes out??? Thanks, Alan -- Posted via http://www.ruby-forum.com/.