in reply to CGI problem
"...the '==' has to be used for numeric and 'eq' in case of strings."
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Yes, '==' for numeric, 'eq' for strings, and '=' for assignments.
Years ago, I learned a good trick for avoiding this kind of error:
when, in fact, you meant to say:if ($query_str='') { ... }
if ($query_str == '') { ... }
If you get in the habit of always putting the constant on the left side of the '==' sign:
then, if you accidentally drop one of the '=', you'll get an error:if ('' == $query_str) { ... }
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!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.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: CGI problem
by Anonymous Monk on Nov 06, 2011 at 21:49 UTC | |
by Anonymous Monk on Nov 07, 2011 at 09:36 UTC | |
by Corion (Patriarch) on Nov 07, 2011 at 09:46 UTC | |
by Anonymous Monk on Nov 09, 2011 at 16:57 UTC |
In Section
Seekers of Perl Wisdom