From: "Mauricio Fernández" Date: 2004-09-14T20:34:55+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 ? Try to run with -w: batsman@tux-chan:~/src/rpa/rpa-base$ ruby -w a = { "key1" => 1, "key2" => 2} unless a[$the_ley] # orthographic error !!! # ruby doesnt catch this error puts "SURPRISE!!" end -:4: warning: global variable `$the_ley' not initialized SURPRISE!! -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com