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

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

    Perl has postfix variants for many of its statements. It's just that you write the keyword after the one-statement body.

    You can use if, unless, etc. in the same way.

提交回复
热议问题