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

后端 未结 4 1805
执念已碎
执念已碎 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:12

    It seems to me like the standard Perl for. Takes each element and executes the body (in this case is before) with $_ substituted with each element. It is just an alternate syntax for: for (@array) { statements }

提交回复
热议问题