有没有快速的方法来确定运营商的优先级和关联性?

mat*_*ull 3 perl operator-precedence associativity

我知道perlop.我正在寻找的是像GHCi :info命令一样的快速查找:

ghci> :info (+)
class (Eq a, Show a) => Num a where
    (+) :: a -> a -> a
    ...
    -- Defined in GHC.Num
infixl 6 +
Run Code Online (Sandbox Code Playgroud)

我学习的地方(+)是左联想的,并且该infixl 6 +行的优先级别为6 .

bvr*_*bvr 6

我意识到这不是你要求的,但是怎么样:

perl -MO=Deparse,-p -e "print $a+$b*$c**$d;"
Run Code Online (Sandbox Code Playgroud)

它根据优先级在表达式周围打印括号:

print(($a + ($b * ($c ** $d))));
Run Code Online (Sandbox Code Playgroud)

对于perl distibution之外的东西,你可以查看perlopquick - pod的排列方式与你在问题中指定的方式非常相似.