Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Avoiding the == blues

by SolidState (Scribe)
on Dec 30, 2004 at 08:37 UTC ( [id://418215]=note: print w/replies, xml ) Need Help??


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:
perl -ne'if(m/if\s*\(.+?=[^~].+?\)/){print "Possible use of = instead +of == in line $.\n"}' script.pl
Of course this won't catch cases where the if and conditional are not on the same line, or constructs such as:
something() if $var1 = $var2;
Covering more cases will require a full blown script... or perhaps a new CPAN module :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://418215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found