> Let me rephrase what I want to do since I was so unclear the first
> time:  I want to output an error message every time the input
> includes characters that are not the following: A-Za-z0-9_@.- or a
> space(s).

> At this point, I've tried:
>
> if ($params{$i} !~ /[^\w\@.-\s]/g) {
> print "Error Message";
> }
> #output: prints error msg every time

This regex matches anything that is *not* A-Za-z0-9_@.- or space(s) i.e.
your unwanted characters.
You then use the 'does not match' operator !~
You are saying 'if there are no unwanted characters, print error message'.
I suspect that is not what you want :)

> unless ($params{$i} =~ /[^\w\@.-\s]/g) {
> print "Error Message";
> }
> #output: prints error msg every time

Here you have the same statement expressed slightly differently:
'Unless there are unwanted characters, print error message'.

This is what japhy meant when he said:

> >You're using !=, when you "meant" to use !~, but you really want to use
=~
> >
> >>{if ($params{$i}!=m/[^\w@.-]/g)
> >
> >  if ($params{$i} =~ /[^\w\@.-]/) {
> >    # badness
> >  }

Does that make things clearer?

Rachel


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

Reply via email to