in reply to Odd behavior of given {when (... or ...) ...}

perlsyn says that it only uses the 'smart match both sides of OR/AND/||/&&' _if_ both sides are prone to smart matching, i.e., they do not contain """
. a subroutine or method call
. a regular expression match, i.e. /REGEX/ or $foo =~ /REGEX/, or a negated regular expression match $foo !~ /REGEX/
. a comparison such as $_ < 10 or $x eq "abc" (or of course $_ ~~ $c)
. defined(...), exists(...), or eof(...)
. A negated expression !(...) or not (...), or a logical exclusive-or (...) xor (...)
"""

Replies are listed 'Best First'.
Re^2: Odd behavior of given {when (... or ...) ...}
by Polynomial (Acolyte) on Jun 25, 2008 at 11:08 UTC
    Right, and as string literals are none of those things, I'm pretty sure they should get converted to $_ ~~ 'foo'. I guess I'll file a bug report.