Hi --

On Fri, 2 May 2003, Dave Baldwin wrote:

> I find these alternative ways of reading and processing a file  very
> illuminating and makes me appreciate much more the elegance and power
> or ruby.  Would anyone care to add some error handling to them without
> destroying their elegance, as I surely would do.

With trepidation.... :-)

You can always wrap them in a rescue clause:

  begin
    puts File.open("file") {|f| f.grep(/o/)}
  rescue => e
    puts "Problem with IO operation: #{e}"
    exit 1
  end


David

-- 
David Alan Black
home: dblack / superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav