>> I have a cgi that  need to accept only  numeric values. ie +ve or -ve
>> real numbers.
>> Is there a quick and easy way to check this. I was trying using a reg exp
>> if(/^[-0-9][\.0-9]*/) {
>>  do something
>> }
>>
>> but this breaks when the number is say --75.4  It still accepts if it
>> has two - signs.

I just created a script for testing on the CLI for requiring 5 digit zip
code, for which i have imported 50,000 zip codes into a table for testing
this.

sub notenough{$zipentered}{
        while($zipentered !~ m/[0-9][0-9][0-9][0-9][0-9]/){
                print "I require 5 numbers, no more, no less.  Try Again.\n";
                print "Enter a zip code to search for: ";
                $zipentered=<>;
        }
}

The only problem that i have is that if i put in >5 it breaks but works if i
put in <5.
Hope this helps.
Any fix for my problems are welcome, and needed.

Rob


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

Reply via email to