A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Perl code review

What is wrong with this line of code?

return !grep { $_ == $item->id } grep { $_ } @$scanned_items;

A lot of things are implicit in it.
It returns 1 (true) if the count is zero, and "" (emtpy string - false) if the count is non-zero.

I would prefer for it to be written more explicitly:

my $item_count = scalar grep { defined $_ && $_ == $item->id } @$scanned_items;
return ($item_count > 0) ? 0 : 1;