通过本文主要向大家介绍了perl or die,python与perl的区别,perl中,perl中 是什么意思,perl中split等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
来看看下面的代码会输出什么?
输出:
0
1
为什么呢?因为||, =, or 这三者优先级从左至右逐渐降低。
所以,这样写可以:
chomp(my $filename = shift( @ARGV ) || <STDIN>);
这样则不行:
chomp(my $filename = shift( @ARGV ) or <STDIN>);
会提示如下错误:
Can't modify logical or (||) in chomp

