http://www.perlmonks.org?node_id=936293


in reply to CGI problem

    "...the '==' has to be used for numeric and 'eq' in case of strings."

Yes, '==' for numeric, 'eq' for strings, and '=' for assignments.

Years ago, I learned a good trick for avoiding this kind of error:

if ($query_str='') { ... }
when, in fact, you meant to say:
if ($query_str == '') { ... }

If you get in the habit of always putting the constant on the left side of the '==' sign:

if ('' == $query_str) { ... }
then, if you accidentally drop one of the '=', you'll get an error:
if ('' = $query_str) { ... } # Produces: # Can't modify constant item in scalar assignment at example.pl line + 3, # near "$query_str) " # Execution of example.pl aborted due to compilation errors.
I don't usually make the mistake of writing '=' where I meant '==', but whenever I do, thanks to putting the constant on the left side, the compiler now let's me know about it in no uncertain terms!

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/