Hello Jonathan & All,

Thank you for taking the time to answer. I "thought" that the $1 was
locally scoped but didn't want to "assume" it. Better not to assume
things with Perl has been my experience.

I don't fully understand the trinary operator. However I'll research
this tonight.

My main concern was that I didn't want people to be able to gain any
access to my server using my form as a gateway. Is there a better way
to filter/secure input to my script when using CGI.pm? Is the input
automagically filtered when using CGI.pm? I'm not finding anything
about this subject in the CGI.pm docs. Am I not looking hard enough?

Again, thank you for your time & help.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=====================================================+
+ "Only two things are infinite, the universe and     +
+ human stupidity, and I'm not sure about the former."+
+                                 -- Albert Einstien  +
+=====================================================+

Monday, January 07, 2002, 1:50:39 PM, you wrote:

>> 1. Why doesn't "use strict" complain about the $1 not
>> being declared?

JEP> $1, $2 etc are locally scoped variables which come from the
JEP> regex.  A regex like:

JEP> m/(..)(.*)/

JEP> will place the first two characters into $1, and the rest
JEP> into $2 - according to the parathesis.

>> 2. How can I filter ALL of my form input variables with
>> this regex? Or maybe better asked;  How can this be
>> WRITTEN to filter ALL of my form variables at once?

JEP> Usually you don't want to use the same one for all,
JEP> although you can.  Do something like:

JEP> foreach ($value1, $value2, $value3) {
JEP>   /^(................)$/ ? $_=$1 : undef $_;
JEP> }

JEP> The ? : is a special trinary operator which effectively
JEP> does:

JEP> if (...)   {...} else {...}
JEP>    (...) ? {...}  :   {...}

JEP> Take care,

JEP> Jonathan Paton

JEP> __________________________________________________
JEP> Do You Yahoo!?
JEP> Everything you'll ever need on one web page
JEP> from News and Sport to Email and Music Charts
JEP> http://uk.my.yahoo.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to