in reply to Avoiding the == blues
Since most people tend to write the "if" and and conditional on the same line, the following one-liner should work for most Perl scripts:
Of course this won't catch cases where the if and conditional are not on the same line, or constructs such as:perl -ne'if(m/if\s*\(.+?=[^~].+?\)/){print "Possible use of = instead +of == in line $.\n"}' script.pl
Covering more cases will require a full blown script... or perhaps a new CPAN module :-)something() if $var1 = $var2;
|
---|
In Section
Meditations