On Tue, Dec 16, 2003 at 07:16:23AM +0900, Ron Coutts wrote: > file = File.open("ordinal") > while file.gets > print if /third/ .. /fifth/ > End > > Unfortunately this code snippet is buggy as it prints out all ten lines > of the file, not just lines three through five as mentioned in the book. > So I'm still stuck on this problem. That's one of the things that changed between Ruby 1.6 (which is what's documented in the Pickaxe book) and 1.8. There's a list of the changes here: ftp://ftp.ruby-lang.org/pub/ruby/1.8/changes.1.8.0 You can use the example with one small modification: replace the bare regexes with ~ + regex: file = File.open("ordinal") while file.gets print if ~/third/ .. ~/fifth/ end -Mark