There is a Perl code line below where I get the message from perlcritic
:
map { $total_ids += scalar @{$ids->{$_}} } @brands;
The message is:
"map" used in void context near 'map { $total_ids += scalar @{$ids->{$_}} } @brands;'
Can anyone help me to fix it?
map
returns a list, which in void context is thrown away.
As recommended by Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap, turn your map
into a foreach
$total_ids += scalar @{$ids->{$_}} foreach @brands;