My work colleague Mike O'Regan created a policy for the latest version of Perl::Critic.

Now if you have a line of code like this:


my $n += somefunc();
# Should be my $n = somefunc();

Perl::Critic will tell you

Augmented assignment operator '+=' used in declaration at line X, column Y. Use simple assignment when initializing variables.

If you haven't let Perl::Critic loose on your code yet, now's a great time to try.

To the loyal Perl::Critic users, what's the nastiest bug Perl::Critic found for you? Let me know in the comments.