Darth Aureous suggested: > I think the challenge inherent in the ambiguous RHS case is improved if we > give people a way to detect it and respond appropriately. E.g. > > when { $lhs ~~ $rhs // $lhs ~~ "$rhs" } { ... } Oh, that's so evil! dagolden++ Though maybe I'd be inclined to SWIM there: when { $_ ~~ $rhs // $_ eq $rhs } { ... } Which you can also write (albeit with much less Sith) like so: when (any $rhs, "$rhs") {...} And that scales rather nicely to a general fallback idiom: # Try == then eq then =~ when (any 0+$rhs, "$rhs", qr/$rhs/) {...} Of course, normally you'd just write: # Try ==, then eq, then =~ when (0+$rhs) {...} when ("$rhs") {...} when (qr/$rhs/) {...} but if the block was complex, and identical in all three cases, it would be much easier to have only a single 'when'. :-) DamianThread Previous | Thread Next