目录
布尔值及逻辑运算符
-
Perl语言布尔值(Boolean Values)
数字标量,0为假,其他数字为真;
字符串标量,''为假,其他为真;
其它先转化为以上两种再判断;
"!"表示取反。
-
逻辑运算符
运算符 含义 实例
and(&&) 且 condition1 and condition2,两个条件都为真,返回真
or(||) 或 condition1 or condition2,两个条件有一个为真,返回真
not(!) 取反 not condition1,条件为真,取反则为假