当前位置: 动力学知识库 > 问答 > 编程问答 >

Is there a way to determine exactly what operator a Perl B::LOGOP object refers to?

问题描述:

From playing with B, I see that a B::LOGOP object (call it "$op") referring to either a && or and operator will both return "and" upon calling $op->name. Is it possible to determine which operator the LOGOP refers to merely by examining $op?

网友答案:

I am not expert for perl internals, but LOGOP refers to logical operator group. So I don't think you can know individual operator without examining the name. Even B::Terse displays it:

perl -MO=Terse -e '$a && $b'

Shows:

....
        LOGOP (0x198ad94) and
            UNOP (0x198adec) null [15]
                PADOP (0x198ae08) gvsv  GV (0x187bb9c) *a
            UNOP (0x198adb4) null [15]
                PADOP (0x198add0) gvsv  GV (0x187bc9c) *b
分享给朋友:
您可能感兴趣的文章:
随机阅读: