Where is Perl's postfix `for` syntax documented?

后端 未结 4 1785
执念已碎
执念已碎 2021-02-18 16:38

I recently came across the following code snippet

$count_stuff{$_}++ for @stuff;

It\'s a pretty convenient way to use a hash to count occurrenc

4条回答
  •  不知归路
    2021-02-18 17:25

    It is documented in the "perlsyn" man page, under Statement Modifiers (which talks about the postfix syntax) and under Foreach Loops (which explains that "for" and "foreach" are synonyms).

提交回复
热议问题