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
According to this page it is documented here
And you should read Foreach Loops to get answer for your question.
In short, If you you understand this well:
for my $item ( @array ) { print $item }
And know syntax of for
and print
:
LABEL for VAR (LIST) BLOCK
print LIST
According to the doc of foreach: If VAR is omitted, $_ is set to each value.
And according to the doc of print: If LIST is omitted, prints $_
So we can reduce the example above:
for ( @array ) { print }
In the postfix form it will look like this:
print for @array;