From: Brian Candler Date: 2004-09-14T21:37:36+09:00 Subject: Re: Catching undefined global variable errors On Tue, Sep 14, 2004 at 07:34:52PM +0900, George Moschovitis wrote: > Sorry everyone, > > my example was wrong, THIS is the surprising code: > > $the_key = "key1" > > a = { "key1" => 1, "key2" => 2} > > unless a[$the_ley] # orthographic error !!! > # ruby doesnt catch this error > puts "SURPRISE!!" > end > > the orthographic error is in the variable. Shouldnt this be catched by > the interpreter ? Any ideas ? Turning warnings on catches this: # ruby -w scriptname.rb or #!/usr/local/bin/ruby -w # at the top of the script or $VERBOSE=true Matz has said in the past that it was a mistake to leave warnings turned off by default :-) Regards, Brian.