I recently came across the following code snippet
$count_stuff{$_}++ for @stuff;
It's a pretty convenient way to use a hash to count occurrences of strings in an array for example. I understand how it works, but not why it works. I can not find the documentation for this way of using for.
Why does it work? And where is the documentation?