Hmmm.... I'm not getting where I want to go.  Consider the following code:

#!/usr/bin/perl -w

@a = (  "chuck",        # Good
        "chuck99",      # bad - numbers in a name?
        "chuck_5",      # bad - numbers/underscore in a name
        "chuck!3",      # bad - symbols?
        "chuck t",      # good (e.g. lastname could be "van gogh" 
        "chuck's",      # good (e.g. lastname could be "O'Mally"
        "chuck()"       # bad - symbols
);

foreach $st (@a) {
        if ($st !~ /[a-zA-Z \']+/) {
                print "$st: bad chars found\n";
        } else {
                print "$st: OK\n";
        }
}


If I use "$st =~ /[a-zA-Z \']+/" it simply says "Do you see one or more of
these in the string?" and says all array items are OK.  If I use !~ then
it says "If you don't see one of these in the string..." it reports they
are all bad.  What I need is "Do you see something other than one of
these?" to flag the bad strings.

--Chuck


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

Reply via email to