Reputation: 615
I have:
$rejected->{join ',', @needed}++ unless @filtered;
but the perlcritic
complains with
title=Hash key with quotes - severity 5::[HashKeyQuotes] Avoid useless quotes
Obviously I can lower the severity, but I wonder whether there is any other way?
Two which I can think of are:
join
outside the {}
.Is there any other approach?
Upvotes: 3
Views: 107
Reputation: 385839
If you get that critic from that code, it's obviously a bug in the HashKeyQuotes
policy since you don't have useless quotes around hash keys.
Flag it to be ignored. Contorting your code to silence perlcritic defies the whole point of using perlcritic.
Upvotes: 5
Reputation: 2554
I believe it's not within PBP to use quotes like that on join
. Try:
$rejected->{join(q{,}, @needed)}++ unless @filtered;
I don't see any perlcritic
warnings with this.
In general though, I would block this on a code review, and ask for you to move the join
to a new lexically scoped variable, with a decent name.
Upvotes: 3