Audrey Tang 提到: > John M. Dlugosz 提到: > >> = on Parallelized parameters and autothreading >> >> use autoindex; >> do { @c[$^i, $^j, $^k, $^l] = @a[$^i, $^j] * @b[$^k, $^l] }; >> >> Shouldn't those be semicolons? Ditto for subsequent examples. >> Also, what does the "do" do? I think it is only meaningful if there was >> something using this block's return value. I suspect it is a relic of p5 >> notation. > > No, something more subtle is going on -- the "do STATEMENT" notation > sees a stand-alone block in statement position, so it's automatically > called with no arguments.
Er, sorry, that wasn't entirely correct. :-) It's actually using the "do BLOCK" form, which implicitly calls the block once, with no arguments, as defined in S04/"The do-once loop". So the paragraph that mentioned "do STATEMENT" in my previous mail should instead read: " or you can use the C<do BLOCK> syntax (see L<S04/"The do-once loop">) to call that closure, which also implicit iterates: " Cheers, Audrey