From: ara.t.howard@... Date: 2006-08-25T23:46:41+09:00 Subject: Re: unless =~ vs. ! =~ On Fri, 25 Aug 2006, Marco Lazzeri wrote: > Hi! > > Could someone please help me understanding why the next two lines of > code are different? > > next unless line =~ /=/ > > next if !line =~ /=/ > > > Thanks, > Marco harp:~ > cat a.rb require 'yaml' y "!'foobar'" => (!'foobar') y "!'foobar' =~ /barfoo/" => (!'foobar' =~ /barfoo/) y "false =~ /barfoo/" => (false =~ /barfoo/) y "'foobar' !~ /barfoo/" => ('foobar' !~ /barfoo/) harp:~ > ruby a.rb a.rb:3: warning: string literal in condition a.rb:4: warning: string literal in condition "!'foobar'": false "!'foobar' =~ /barfoo/": false false =~ /barfoo/: false "'foobar' !~ /barfoo/": true ! binds more tightly that =~ -a -- to foster inner awareness, introspection, and reasoning is more efficient than meditation and prayer. - h.h. the 14th dalai lama