LS> I have a script that is used for text messaging. I added a 
LS> line of code to check to make sure that input is in a field 
LS> before the message is sent. My code is as follows:
LS> 
LS> if($b !~ m/^\w[\w\s]*\w$/) { $error .= "Enter a message <br> \n"; }
LS> 
LS> This fails if the field has any punctuation characters. I 
LS> have checked on www.perldoc.com but I seem to be going in the 
LS> wrong direction. I only want it to check to make sure there 
LS> is data in the field. I am not concerned with what the data 
LS> is. This is only to keep people from sending blank messages. 

DM> Why din't you say so! Istead of a regex just do this
DM>
DM> if(!$b) { $error .=  ...
DM> That says if $b does not contain anything
DM> if($b) { 
DM> Says if $b contains anything

Dan,
        if (!$b) { $error .= ...

will set the $error code if $b is a string containing just a zero,
the string then contains something, but error is still set.

                        /\/\ark

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

Reply via email to