On Fri, Apr 21, 2006 at 11:06:20AM -0700, Larry Wall wrote:
> On Fri, Apr 21, 2006 at 12:45:13PM -0500, Jonathan Scott Duff wrote:
> : According to S05,  "a /.../ matches immediately in a value context
> : (void, Boolean, string, or numeric)" and since 
> : 
> :     (state $x) ||= / pattern /;
> : 
> : is very much the same as 
> : 
> :     state $x; $x = $x || /pattern/;
> : 
> : I'd say that's a "boolean context" and thus matches against $_ instead
> : of assigning the Regex object to $x.
> 
> Except the right side of || isn't in boolean context till you evaluate
> $x that way, so it probably wants to be written with m//:

I almost added a little bit of text to the end of that other message
but didn't.  I think it's most appropriate now:

I must say that I have trouble distinguishing when using // gives you
a Regex object and when it actually does pattern matching, so I intend
on always using m// when I want a match, and some form of rx// when I
want an object.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to