More specifically, &logger is bound to a Scalar container whose type is Callable, exactly the same as $logger (with a $ sigil) would be if you wrote my Callable $logger:say .WHAT, .VAR, .VAR.WHAT, .VAR.offor my &logger, my Callable $logger显示:(Callable)Callable(Scalar)(Callable)(Callable)Callable(Scalar)(Callable)这实际上是包含在 绑定到&logger的Scalar容器中的Callable的类型.That's actually the type of the Callable that's contained in the Scalar container that's bound to &logger.这不是容器本身的类型,它是Scalar,如上所示.当给定变量形式的单个参数时,像for这样的迭代功能将查看变量,而不是变量中包含的值,以查看其是否为Iterable. Scalar不是Iterable.When given a single argument in the form of a variable, iterating features like for look at the variable, not the value contained in the variable, to see if it's Iterable. A Scalar is not Iterable.有关一种方法,请参阅lizmat的答案.See lizmat's answer for one approach. 这篇关于什么时候调用迭代器方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-18 23:37