On 1/29/06, John Maclean <info / jayeola.org> wrote: > Hey chaps, Hi John, > (excuse the pun). What's wrong with using constants and what am I doing > wrong in my OO version? Well the first thing that struck me is that hardcoding the path into the program you is not good, it would be a more useful program if you could specify which file to search on the command line as well as the regex in question. I'll leave implementing that method up to you. I'm just learning myself, but I touched up your OO version but kept your logic mostly intact. Enjoy. class Greppa def initialize(file) @f=file end def usage print "(Greppa)Enter a regex:> " end def grabber usage xx = gets.chomp! File.open(@f, 'r') do |test| test.each do |line| puts line if line =~ /#{xx}/ end end end end #Rather than hardcoding lets make a new method that #asks the user for the `data` file data = "/home/flubber/greppa.rb" i = Greppa.new(data) i.grabber -- Alex Combas http://noodlejunkie.blogspot.com/