On Sun, Jan 07, 2007 at 03:33:19AM -0800, Jonathan Lang wrote: : IIRC, you don't even need .accepts for this. You could just say : : given $pattern { : when $a ~~ $_ { ... } : when $b ~~ $_ { ... } : when $c ~~ $_ { ... } : } : : ...since an explicit smart-match is a boolean expression (it is, isn't : it?), and boolean expressions implicitly smart-match according to : their truth. Right?
Very nearly, except that ~~ merely promises to return something that can be used as a boolean, not something that is of Bool type. And, in fact, for a normal regex you'd get a Match object, which as a form of Capture would then try to compare itself back to $pattern, which is not what you want. So you'd have to force it: given $pattern { when true $a ~~ $_ { ... } when true $b ~~ $_ { ... } when true $c ~~ $_ { ... } } Larry