有什么方法可以在 perl 中跟踪 for 循环中迭代的元素数量:就像使用特殊变量一样:
@arrayElements = (2,3,4,5,6,7,67);
foreach (@arrayElements) {
# Do something
# Want to know how may elements been iterated after
# some n number of elements processed without using another variable.
}