From: nobu.nokada@... Date: 2002-02-18T11:05:30+09:00 Subject: Re: x =~ /pat/, "return type?" Hi, At Mon, 18 Feb 2002 10:31:36 +0900, David Corbin wrote: > "if (x =~ /pat/)" everything is OK. When I trty to pass this > expression as an argument to a method expecting TrueClass or FalseClass, > I get a problem. I assume that this expression is an Array of > "backreferences". Is this correct? Where `x' is a String, it returns the first position of /pat/ when matched, or nil. > If so, how can "coerce" this to be > a boolean as one uses in the if.? (if x =~ /pat/ then true else false end) (x =~ /pat/ ? true : false) !(x !~ /pat/) -- Nobu Nakada