当您使用to运算符迭代各个整数时,上下文item(2.0中的上下文item)是未定义的。
As you use the to operator to iterate through various integers, the context item (it's the context item in 2.0) is undefined.
运算符在一个范围内迭代。因此,该脚本并不是数10个行,而是对- n开关生成的循环迭代10次(请参阅“perldoc perlrun”和清单2,以获得该循环的示例)。
Thus, the script does not count 10 lines, it counts 10 iterations of the loop generated by the -n switch (see "perldoc perlrun" and Listing 2 for an example of that loop).
定义一个迭代器,该迭代器可以向前(通过使用递增运算符)或向后(通过使用递减运算符)访问容器中的元素。
Defines an iterator that can access elements in a container in the forward direction by using the increment operator and in the backward direction by using the decrement operator.
应用推荐