in reply to The Swiss Army Chainsaw... Watch out for your legs there, buddy!

This is why we yell, scream, and wave our arms about strict and warnings. With warnings, we get:

$ perl -wle 'my $param = "foo"; if ($param != null) {}' Unquoted string "null" may clash with future reserved word at -e line +1. Argument "null" isn't numeric in numeric ne (!=) at -e line 1. Argument "foo" isn't numeric in numeric ne (!=) at -e line 1.

And with strict we get:

$ perl -Mstrict -wle 'my $param = "foo"; if ($param != null) {}' Bareword "null" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors.

So, tell your coworkers to use strict and warnings unless they know what they're doing. Which, unfortunately, the code you've shown kind of leads me to believe they don't (at least when it comes to Perl).

Replies are listed 'Best First'.
Re^2: The Swiss Army Chainsaw... Watch out for your legs there, buddy!
by nimdokk (Vicar) on Jul 25, 2006 at 17:43 UTC
    Been there, done that. Had a Perl script supplied by our vendor, first thing I did with it was run a syntax check - it errored, found the error then told the vendor how to fix it. Also suggested that the script use warnings and strictness. The latest version does (iirc) :-). I'm now debating if I have time to hack the script so that we can use real regular expressions instead of being limited to * and ?. <sigh>