如果子程序在标量上下文(scalar context)中调用,它将返回为不确定的值,如果子程序在列表上下文(list context)中调用,那么它将返回一个空列表。
基于16个网页-相关网页
The difference lies in using in scalar context (as -n does in the second script) or list context (as the first script does).
区别在于在标量上下文中的使用(如第二个脚本中使用- n)或在列表上下文中的使用(如第一个脚本所做的)。
If a callback does not require arguments, we do not need to create the anonymous list, since Perl treats scalar values, evaluated in list context, as single-element arrays.
如果回调不需要参数,则我们不需要创建那个匿名列表,因为Perl按单元素数组来处理列表上下文中计算得到的数量值。
To do this we create an information context list from the XML fragment.
为此,我们从这个xml片段创建一个信息上下文列表。
应用推荐