Leslie Viljoen schrieb:
> Anyway, now that I have put the begin in the same function as the rescue,
> I no longer get the error. But I still can't redefine Array - now I get:
> 
> /var/www/ruby/core.rb:22:in `num_rows': undefined local variable or
> method `length' for #<#<Module:0xb65fcfec>::Array:0xb65e2c78> (NameError)

You can see that you don't have an Array instance, but an instance of an 
Array class in an anonymous module.

> The first lines of the program are:
> class ::Array
>   def num_rows
>     return length <--- LINE 22
>   end
> end
> 
> a = Array.new
> puts a.num_rows     
> 
> -- so how do I access ::Array.length?

Maybe you can show us more of the code and more than the first line of 
the stack backtrace.

Regards,
Pit