http://www.perlmonks.org?node_id=517556


in reply to Re: Using map to create a hash/bag from an array
in thread Using map to create a hash/bag from an array

Why not use for in this example, since you're not really transforming @items into a new array (common use of map), but rather just performing an action for each value in @items (common use of for).

$bag->{$_}++ for @items; # instead of map {$bag->{$_}++} @items;

    -Bryan